
obj/__user_exit.out：     文件格式 elf32-i386


Disassembly of section .text:

00800020 <__panic>:
#include <stdio.h>
#include <ulib.h>
#include <error.h>

void
__panic(const char *file, int line, const char *fmt, ...) {
  800020:	f3 0f 1e fb          	endbr32 
  800024:	55                   	push   %ebp
  800025:	89 e5                	mov    %esp,%ebp
  800027:	83 ec 28             	sub    $0x28,%esp
    // print the 'message'
    va_list ap;
    va_start(ap, fmt);
  80002a:	8d 45 14             	lea    0x14(%ebp),%eax
  80002d:	89 45 f4             	mov    %eax,-0xc(%ebp)
    cprintf("user panic at %s:%d:\n    ", file, line);
  800030:	8b 45 0c             	mov    0xc(%ebp),%eax
  800033:	89 44 24 08          	mov    %eax,0x8(%esp)
  800037:	8b 45 08             	mov    0x8(%ebp),%eax
  80003a:	89 44 24 04          	mov    %eax,0x4(%esp)
  80003e:	c7 04 24 80 1a 80 00 	movl   $0x801a80,(%esp)
  800045:	e8 0e 07 00 00       	call   800758 <cprintf>
    vcprintf(fmt, ap);
  80004a:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80004d:	89 44 24 04          	mov    %eax,0x4(%esp)
  800051:	8b 45 10             	mov    0x10(%ebp),%eax
  800054:	89 04 24             	mov    %eax,(%esp)
  800057:	e8 bd 06 00 00       	call   800719 <vcprintf>
    cprintf("\n");
  80005c:	c7 04 24 9a 1a 80 00 	movl   $0x801a9a,(%esp)
  800063:	e8 f0 06 00 00       	call   800758 <cprintf>
    va_end(ap);
    exit(-E_PANIC);
  800068:	c7 04 24 f6 ff ff ff 	movl   $0xfffffff6,(%esp)
  80006f:	e8 1e 0a 00 00       	call   800a92 <exit>

00800074 <__warn>:
}

void
__warn(const char *file, int line, const char *fmt, ...) {
  800074:	f3 0f 1e fb          	endbr32 
  800078:	55                   	push   %ebp
  800079:	89 e5                	mov    %esp,%ebp
  80007b:	83 ec 28             	sub    $0x28,%esp
    va_list ap;
    va_start(ap, fmt);
  80007e:	8d 45 14             	lea    0x14(%ebp),%eax
  800081:	89 45 f4             	mov    %eax,-0xc(%ebp)
    cprintf("user warning at %s:%d:\n    ", file, line);
  800084:	8b 45 0c             	mov    0xc(%ebp),%eax
  800087:	89 44 24 08          	mov    %eax,0x8(%esp)
  80008b:	8b 45 08             	mov    0x8(%ebp),%eax
  80008e:	89 44 24 04          	mov    %eax,0x4(%esp)
  800092:	c7 04 24 9c 1a 80 00 	movl   $0x801a9c,(%esp)
  800099:	e8 ba 06 00 00       	call   800758 <cprintf>
    vcprintf(fmt, ap);
  80009e:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8000a1:	89 44 24 04          	mov    %eax,0x4(%esp)
  8000a5:	8b 45 10             	mov    0x10(%ebp),%eax
  8000a8:	89 04 24             	mov    %eax,(%esp)
  8000ab:	e8 69 06 00 00       	call   800719 <vcprintf>
    cprintf("\n");
  8000b0:	c7 04 24 9a 1a 80 00 	movl   $0x801a9a,(%esp)
  8000b7:	e8 9c 06 00 00       	call   800758 <cprintf>
    va_end(ap);
}
  8000bc:	90                   	nop
  8000bd:	c9                   	leave  
  8000be:	c3                   	ret    

008000bf <syscall>:


#define MAX_ARGS            5

static inline int
syscall(int num, ...) {
  8000bf:	55                   	push   %ebp
  8000c0:	89 e5                	mov    %esp,%ebp
  8000c2:	57                   	push   %edi
  8000c3:	56                   	push   %esi
  8000c4:	53                   	push   %ebx
  8000c5:	83 ec 20             	sub    $0x20,%esp
    va_list ap;
    va_start(ap, num);
  8000c8:	8d 45 0c             	lea    0xc(%ebp),%eax
  8000cb:	89 45 e8             	mov    %eax,-0x18(%ebp)
    uint32_t a[MAX_ARGS];
    int i, ret;
    for (i = 0; i < MAX_ARGS; i ++) {
  8000ce:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
  8000d5:	eb 15                	jmp    8000ec <syscall+0x2d>
        a[i] = va_arg(ap, uint32_t);
  8000d7:	8b 45 e8             	mov    -0x18(%ebp),%eax
  8000da:	8d 50 04             	lea    0x4(%eax),%edx
  8000dd:	89 55 e8             	mov    %edx,-0x18(%ebp)
  8000e0:	8b 10                	mov    (%eax),%edx
  8000e2:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8000e5:	89 54 85 d4          	mov    %edx,-0x2c(%ebp,%eax,4)
    for (i = 0; i < MAX_ARGS; i ++) {
  8000e9:	ff 45 f0             	incl   -0x10(%ebp)
  8000ec:	83 7d f0 04          	cmpl   $0x4,-0x10(%ebp)
  8000f0:	7e e5                	jle    8000d7 <syscall+0x18>
    asm volatile (
        "int %1;"
        : "=a" (ret)
        : "i" (T_SYSCALL),
          "a" (num),
          "d" (a[0]),
  8000f2:	8b 55 d4             	mov    -0x2c(%ebp),%edx
          "c" (a[1]),
  8000f5:	8b 4d d8             	mov    -0x28(%ebp),%ecx
          "b" (a[2]),
  8000f8:	8b 5d dc             	mov    -0x24(%ebp),%ebx
          "D" (a[3]),
  8000fb:	8b 7d e0             	mov    -0x20(%ebp),%edi
          "S" (a[4])
  8000fe:	8b 75 e4             	mov    -0x1c(%ebp),%esi
    asm volatile (
  800101:	8b 45 08             	mov    0x8(%ebp),%eax
  800104:	cd 80                	int    $0x80
  800106:	89 45 ec             	mov    %eax,-0x14(%ebp)
        : "cc", "memory");
    return ret;
  800109:	8b 45 ec             	mov    -0x14(%ebp),%eax
}
  80010c:	83 c4 20             	add    $0x20,%esp
  80010f:	5b                   	pop    %ebx
  800110:	5e                   	pop    %esi
  800111:	5f                   	pop    %edi
  800112:	5d                   	pop    %ebp
  800113:	c3                   	ret    

00800114 <sys_exit>:

int
sys_exit(int error_code) {
  800114:	f3 0f 1e fb          	endbr32 
  800118:	55                   	push   %ebp
  800119:	89 e5                	mov    %esp,%ebp
  80011b:	83 ec 08             	sub    $0x8,%esp
    return syscall(SYS_exit, error_code);
  80011e:	8b 45 08             	mov    0x8(%ebp),%eax
  800121:	89 44 24 04          	mov    %eax,0x4(%esp)
  800125:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  80012c:	e8 8e ff ff ff       	call   8000bf <syscall>
}
  800131:	c9                   	leave  
  800132:	c3                   	ret    

00800133 <sys_fork>:

int
sys_fork(void) {
  800133:	f3 0f 1e fb          	endbr32 
  800137:	55                   	push   %ebp
  800138:	89 e5                	mov    %esp,%ebp
  80013a:	83 ec 04             	sub    $0x4,%esp
    return syscall(SYS_fork);
  80013d:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
  800144:	e8 76 ff ff ff       	call   8000bf <syscall>
}
  800149:	c9                   	leave  
  80014a:	c3                   	ret    

0080014b <sys_wait>:

int
sys_wait(int pid, int *store) {
  80014b:	f3 0f 1e fb          	endbr32 
  80014f:	55                   	push   %ebp
  800150:	89 e5                	mov    %esp,%ebp
  800152:	83 ec 0c             	sub    $0xc,%esp
    return syscall(SYS_wait, pid, store);
  800155:	8b 45 0c             	mov    0xc(%ebp),%eax
  800158:	89 44 24 08          	mov    %eax,0x8(%esp)
  80015c:	8b 45 08             	mov    0x8(%ebp),%eax
  80015f:	89 44 24 04          	mov    %eax,0x4(%esp)
  800163:	c7 04 24 03 00 00 00 	movl   $0x3,(%esp)
  80016a:	e8 50 ff ff ff       	call   8000bf <syscall>
}
  80016f:	c9                   	leave  
  800170:	c3                   	ret    

00800171 <sys_yield>:

int
sys_yield(void) {
  800171:	f3 0f 1e fb          	endbr32 
  800175:	55                   	push   %ebp
  800176:	89 e5                	mov    %esp,%ebp
  800178:	83 ec 04             	sub    $0x4,%esp
    return syscall(SYS_yield);
  80017b:	c7 04 24 0a 00 00 00 	movl   $0xa,(%esp)
  800182:	e8 38 ff ff ff       	call   8000bf <syscall>
}
  800187:	c9                   	leave  
  800188:	c3                   	ret    

00800189 <sys_kill>:

int
sys_kill(int pid) {
  800189:	f3 0f 1e fb          	endbr32 
  80018d:	55                   	push   %ebp
  80018e:	89 e5                	mov    %esp,%ebp
  800190:	83 ec 08             	sub    $0x8,%esp
    return syscall(SYS_kill, pid);
  800193:	8b 45 08             	mov    0x8(%ebp),%eax
  800196:	89 44 24 04          	mov    %eax,0x4(%esp)
  80019a:	c7 04 24 0c 00 00 00 	movl   $0xc,(%esp)
  8001a1:	e8 19 ff ff ff       	call   8000bf <syscall>
}
  8001a6:	c9                   	leave  
  8001a7:	c3                   	ret    

008001a8 <sys_getpid>:

int
sys_getpid(void) {
  8001a8:	f3 0f 1e fb          	endbr32 
  8001ac:	55                   	push   %ebp
  8001ad:	89 e5                	mov    %esp,%ebp
  8001af:	83 ec 04             	sub    $0x4,%esp
    return syscall(SYS_getpid);
  8001b2:	c7 04 24 12 00 00 00 	movl   $0x12,(%esp)
  8001b9:	e8 01 ff ff ff       	call   8000bf <syscall>
}
  8001be:	c9                   	leave  
  8001bf:	c3                   	ret    

008001c0 <sys_putc>:

int
sys_putc(int c) {
  8001c0:	f3 0f 1e fb          	endbr32 
  8001c4:	55                   	push   %ebp
  8001c5:	89 e5                	mov    %esp,%ebp
  8001c7:	83 ec 08             	sub    $0x8,%esp
    return syscall(SYS_putc, c);
  8001ca:	8b 45 08             	mov    0x8(%ebp),%eax
  8001cd:	89 44 24 04          	mov    %eax,0x4(%esp)
  8001d1:	c7 04 24 1e 00 00 00 	movl   $0x1e,(%esp)
  8001d8:	e8 e2 fe ff ff       	call   8000bf <syscall>
}
  8001dd:	c9                   	leave  
  8001de:	c3                   	ret    

008001df <sys_pgdir>:

int
sys_pgdir(void) {
  8001df:	f3 0f 1e fb          	endbr32 
  8001e3:	55                   	push   %ebp
  8001e4:	89 e5                	mov    %esp,%ebp
  8001e6:	83 ec 04             	sub    $0x4,%esp
    return syscall(SYS_pgdir);
  8001e9:	c7 04 24 1f 00 00 00 	movl   $0x1f,(%esp)
  8001f0:	e8 ca fe ff ff       	call   8000bf <syscall>
}
  8001f5:	c9                   	leave  
  8001f6:	c3                   	ret    

008001f7 <sys_lab6_set_priority>:

void
sys_lab6_set_priority(uint32_t priority)
{
  8001f7:	f3 0f 1e fb          	endbr32 
  8001fb:	55                   	push   %ebp
  8001fc:	89 e5                	mov    %esp,%ebp
  8001fe:	83 ec 08             	sub    $0x8,%esp
    syscall(SYS_lab6_set_priority, priority);
  800201:	8b 45 08             	mov    0x8(%ebp),%eax
  800204:	89 44 24 04          	mov    %eax,0x4(%esp)
  800208:	c7 04 24 ff 00 00 00 	movl   $0xff,(%esp)
  80020f:	e8 ab fe ff ff       	call   8000bf <syscall>
}
  800214:	90                   	nop
  800215:	c9                   	leave  
  800216:	c3                   	ret    

00800217 <sys_sleep>:

int
sys_sleep(unsigned int time) {
  800217:	f3 0f 1e fb          	endbr32 
  80021b:	55                   	push   %ebp
  80021c:	89 e5                	mov    %esp,%ebp
  80021e:	83 ec 08             	sub    $0x8,%esp
    return syscall(SYS_sleep, time);
  800221:	8b 45 08             	mov    0x8(%ebp),%eax
  800224:	89 44 24 04          	mov    %eax,0x4(%esp)
  800228:	c7 04 24 0b 00 00 00 	movl   $0xb,(%esp)
  80022f:	e8 8b fe ff ff       	call   8000bf <syscall>
}
  800234:	c9                   	leave  
  800235:	c3                   	ret    

00800236 <sys_gettime>:

int
sys_gettime(void) {
  800236:	f3 0f 1e fb          	endbr32 
  80023a:	55                   	push   %ebp
  80023b:	89 e5                	mov    %esp,%ebp
  80023d:	83 ec 04             	sub    $0x4,%esp
    return syscall(SYS_gettime);
  800240:	c7 04 24 11 00 00 00 	movl   $0x11,(%esp)
  800247:	e8 73 fe ff ff       	call   8000bf <syscall>
}
  80024c:	c9                   	leave  
  80024d:	c3                   	ret    

0080024e <sys_exec>:

int
sys_exec(const char *name, int argc, const char **argv) {
  80024e:	f3 0f 1e fb          	endbr32 
  800252:	55                   	push   %ebp
  800253:	89 e5                	mov    %esp,%ebp
  800255:	83 ec 10             	sub    $0x10,%esp
    return syscall(SYS_exec, name, argc, argv);
  800258:	8b 45 10             	mov    0x10(%ebp),%eax
  80025b:	89 44 24 0c          	mov    %eax,0xc(%esp)
  80025f:	8b 45 0c             	mov    0xc(%ebp),%eax
  800262:	89 44 24 08          	mov    %eax,0x8(%esp)
  800266:	8b 45 08             	mov    0x8(%ebp),%eax
  800269:	89 44 24 04          	mov    %eax,0x4(%esp)
  80026d:	c7 04 24 04 00 00 00 	movl   $0x4,(%esp)
  800274:	e8 46 fe ff ff       	call   8000bf <syscall>
}
  800279:	c9                   	leave  
  80027a:	c3                   	ret    

0080027b <sys_open>:

int
sys_open(const char *path, uint32_t open_flags) {
  80027b:	f3 0f 1e fb          	endbr32 
  80027f:	55                   	push   %ebp
  800280:	89 e5                	mov    %esp,%ebp
  800282:	83 ec 0c             	sub    $0xc,%esp
    return syscall(SYS_open, path, open_flags);
  800285:	8b 45 0c             	mov    0xc(%ebp),%eax
  800288:	89 44 24 08          	mov    %eax,0x8(%esp)
  80028c:	8b 45 08             	mov    0x8(%ebp),%eax
  80028f:	89 44 24 04          	mov    %eax,0x4(%esp)
  800293:	c7 04 24 64 00 00 00 	movl   $0x64,(%esp)
  80029a:	e8 20 fe ff ff       	call   8000bf <syscall>
}
  80029f:	c9                   	leave  
  8002a0:	c3                   	ret    

008002a1 <sys_close>:

int
sys_close(int fd) {
  8002a1:	f3 0f 1e fb          	endbr32 
  8002a5:	55                   	push   %ebp
  8002a6:	89 e5                	mov    %esp,%ebp
  8002a8:	83 ec 08             	sub    $0x8,%esp
    return syscall(SYS_close, fd);
  8002ab:	8b 45 08             	mov    0x8(%ebp),%eax
  8002ae:	89 44 24 04          	mov    %eax,0x4(%esp)
  8002b2:	c7 04 24 65 00 00 00 	movl   $0x65,(%esp)
  8002b9:	e8 01 fe ff ff       	call   8000bf <syscall>
}
  8002be:	c9                   	leave  
  8002bf:	c3                   	ret    

008002c0 <sys_read>:

int
sys_read(int fd, void *base, size_t len) {
  8002c0:	f3 0f 1e fb          	endbr32 
  8002c4:	55                   	push   %ebp
  8002c5:	89 e5                	mov    %esp,%ebp
  8002c7:	83 ec 10             	sub    $0x10,%esp
    return syscall(SYS_read, fd, base, len);
  8002ca:	8b 45 10             	mov    0x10(%ebp),%eax
  8002cd:	89 44 24 0c          	mov    %eax,0xc(%esp)
  8002d1:	8b 45 0c             	mov    0xc(%ebp),%eax
  8002d4:	89 44 24 08          	mov    %eax,0x8(%esp)
  8002d8:	8b 45 08             	mov    0x8(%ebp),%eax
  8002db:	89 44 24 04          	mov    %eax,0x4(%esp)
  8002df:	c7 04 24 66 00 00 00 	movl   $0x66,(%esp)
  8002e6:	e8 d4 fd ff ff       	call   8000bf <syscall>
}
  8002eb:	c9                   	leave  
  8002ec:	c3                   	ret    

008002ed <sys_write>:

int
sys_write(int fd, void *base, size_t len) {
  8002ed:	f3 0f 1e fb          	endbr32 
  8002f1:	55                   	push   %ebp
  8002f2:	89 e5                	mov    %esp,%ebp
  8002f4:	83 ec 10             	sub    $0x10,%esp
    return syscall(SYS_write, fd, base, len);
  8002f7:	8b 45 10             	mov    0x10(%ebp),%eax
  8002fa:	89 44 24 0c          	mov    %eax,0xc(%esp)
  8002fe:	8b 45 0c             	mov    0xc(%ebp),%eax
  800301:	89 44 24 08          	mov    %eax,0x8(%esp)
  800305:	8b 45 08             	mov    0x8(%ebp),%eax
  800308:	89 44 24 04          	mov    %eax,0x4(%esp)
  80030c:	c7 04 24 67 00 00 00 	movl   $0x67,(%esp)
  800313:	e8 a7 fd ff ff       	call   8000bf <syscall>
}
  800318:	c9                   	leave  
  800319:	c3                   	ret    

0080031a <sys_seek>:

int
sys_seek(int fd, off_t pos, int whence) {
  80031a:	f3 0f 1e fb          	endbr32 
  80031e:	55                   	push   %ebp
  80031f:	89 e5                	mov    %esp,%ebp
  800321:	83 ec 10             	sub    $0x10,%esp
    return syscall(SYS_seek, fd, pos, whence);
  800324:	8b 45 10             	mov    0x10(%ebp),%eax
  800327:	89 44 24 0c          	mov    %eax,0xc(%esp)
  80032b:	8b 45 0c             	mov    0xc(%ebp),%eax
  80032e:	89 44 24 08          	mov    %eax,0x8(%esp)
  800332:	8b 45 08             	mov    0x8(%ebp),%eax
  800335:	89 44 24 04          	mov    %eax,0x4(%esp)
  800339:	c7 04 24 68 00 00 00 	movl   $0x68,(%esp)
  800340:	e8 7a fd ff ff       	call   8000bf <syscall>
}
  800345:	c9                   	leave  
  800346:	c3                   	ret    

00800347 <sys_fstat>:

int
sys_fstat(int fd, struct stat *stat) {
  800347:	f3 0f 1e fb          	endbr32 
  80034b:	55                   	push   %ebp
  80034c:	89 e5                	mov    %esp,%ebp
  80034e:	83 ec 0c             	sub    $0xc,%esp
    return syscall(SYS_fstat, fd, stat);
  800351:	8b 45 0c             	mov    0xc(%ebp),%eax
  800354:	89 44 24 08          	mov    %eax,0x8(%esp)
  800358:	8b 45 08             	mov    0x8(%ebp),%eax
  80035b:	89 44 24 04          	mov    %eax,0x4(%esp)
  80035f:	c7 04 24 6e 00 00 00 	movl   $0x6e,(%esp)
  800366:	e8 54 fd ff ff       	call   8000bf <syscall>
}
  80036b:	c9                   	leave  
  80036c:	c3                   	ret    

0080036d <sys_fsync>:

int
sys_fsync(int fd) {
  80036d:	f3 0f 1e fb          	endbr32 
  800371:	55                   	push   %ebp
  800372:	89 e5                	mov    %esp,%ebp
  800374:	83 ec 08             	sub    $0x8,%esp
    return syscall(SYS_fsync, fd);
  800377:	8b 45 08             	mov    0x8(%ebp),%eax
  80037a:	89 44 24 04          	mov    %eax,0x4(%esp)
  80037e:	c7 04 24 6f 00 00 00 	movl   $0x6f,(%esp)
  800385:	e8 35 fd ff ff       	call   8000bf <syscall>
}
  80038a:	c9                   	leave  
  80038b:	c3                   	ret    

0080038c <sys_getcwd>:

int
sys_getcwd(char *buffer, size_t len) {
  80038c:	f3 0f 1e fb          	endbr32 
  800390:	55                   	push   %ebp
  800391:	89 e5                	mov    %esp,%ebp
  800393:	83 ec 0c             	sub    $0xc,%esp
    return syscall(SYS_getcwd, buffer, len);
  800396:	8b 45 0c             	mov    0xc(%ebp),%eax
  800399:	89 44 24 08          	mov    %eax,0x8(%esp)
  80039d:	8b 45 08             	mov    0x8(%ebp),%eax
  8003a0:	89 44 24 04          	mov    %eax,0x4(%esp)
  8003a4:	c7 04 24 79 00 00 00 	movl   $0x79,(%esp)
  8003ab:	e8 0f fd ff ff       	call   8000bf <syscall>
}
  8003b0:	c9                   	leave  
  8003b1:	c3                   	ret    

008003b2 <sys_getdirentry>:

int
sys_getdirentry(int fd, struct dirent *dirent) {
  8003b2:	f3 0f 1e fb          	endbr32 
  8003b6:	55                   	push   %ebp
  8003b7:	89 e5                	mov    %esp,%ebp
  8003b9:	83 ec 0c             	sub    $0xc,%esp
    return syscall(SYS_getdirentry, fd, dirent);
  8003bc:	8b 45 0c             	mov    0xc(%ebp),%eax
  8003bf:	89 44 24 08          	mov    %eax,0x8(%esp)
  8003c3:	8b 45 08             	mov    0x8(%ebp),%eax
  8003c6:	89 44 24 04          	mov    %eax,0x4(%esp)
  8003ca:	c7 04 24 80 00 00 00 	movl   $0x80,(%esp)
  8003d1:	e8 e9 fc ff ff       	call   8000bf <syscall>
}
  8003d6:	c9                   	leave  
  8003d7:	c3                   	ret    

008003d8 <sys_dup>:

int
sys_dup(int fd1, int fd2) {
  8003d8:	f3 0f 1e fb          	endbr32 
  8003dc:	55                   	push   %ebp
  8003dd:	89 e5                	mov    %esp,%ebp
  8003df:	83 ec 0c             	sub    $0xc,%esp
    return syscall(SYS_dup, fd1, fd2);
  8003e2:	8b 45 0c             	mov    0xc(%ebp),%eax
  8003e5:	89 44 24 08          	mov    %eax,0x8(%esp)
  8003e9:	8b 45 08             	mov    0x8(%ebp),%eax
  8003ec:	89 44 24 04          	mov    %eax,0x4(%esp)
  8003f0:	c7 04 24 82 00 00 00 	movl   $0x82,(%esp)
  8003f7:	e8 c3 fc ff ff       	call   8000bf <syscall>
}
  8003fc:	c9                   	leave  
  8003fd:	c3                   	ret    

008003fe <opendir>:
#include <error.h>
#include <unistd.h>

DIR dir, *dirp=&dir;
DIR *
opendir(const char *path) {
  8003fe:	f3 0f 1e fb          	endbr32 
  800402:	55                   	push   %ebp
  800403:	89 e5                	mov    %esp,%ebp
  800405:	53                   	push   %ebx
  800406:	83 ec 34             	sub    $0x34,%esp

    if ((dirp->fd = open(path, O_RDONLY)) < 0) {
  800409:	8b 1d 00 30 80 00    	mov    0x803000,%ebx
  80040f:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
  800416:	00 
  800417:	8b 45 08             	mov    0x8(%ebp),%eax
  80041a:	89 04 24             	mov    %eax,(%esp)
  80041d:	e8 df 00 00 00       	call   800501 <open>
  800422:	89 03                	mov    %eax,(%ebx)
  800424:	8b 03                	mov    (%ebx),%eax
  800426:	85 c0                	test   %eax,%eax
  800428:	78 44                	js     80046e <opendir+0x70>
        goto failed;
    }
    struct stat __stat, *stat = &__stat;
  80042a:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  80042d:	89 45 f4             	mov    %eax,-0xc(%ebp)
    if (fstat(dirp->fd, stat) != 0 || !S_ISDIR(stat->st_mode)) {
  800430:	a1 00 30 80 00       	mov    0x803000,%eax
  800435:	8b 00                	mov    (%eax),%eax
  800437:	8b 55 f4             	mov    -0xc(%ebp),%edx
  80043a:	89 54 24 04          	mov    %edx,0x4(%esp)
  80043e:	89 04 24             	mov    %eax,(%esp)
  800441:	e8 5f 01 00 00       	call   8005a5 <fstat>
  800446:	85 c0                	test   %eax,%eax
  800448:	75 27                	jne    800471 <opendir+0x73>
  80044a:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80044d:	8b 00                	mov    (%eax),%eax
  80044f:	25 00 70 00 00       	and    $0x7000,%eax
  800454:	3d 00 20 00 00       	cmp    $0x2000,%eax
  800459:	75 16                	jne    800471 <opendir+0x73>
        goto failed;
    }
    dirp->dirent.offset = 0;
  80045b:	a1 00 30 80 00       	mov    0x803000,%eax
  800460:	c7 40 04 00 00 00 00 	movl   $0x0,0x4(%eax)
    return dirp;
  800467:	a1 00 30 80 00       	mov    0x803000,%eax
  80046c:	eb 09                	jmp    800477 <opendir+0x79>
        goto failed;
  80046e:	90                   	nop
  80046f:	eb 01                	jmp    800472 <opendir+0x74>
        goto failed;
  800471:	90                   	nop

failed:
    return NULL;
  800472:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800477:	83 c4 34             	add    $0x34,%esp
  80047a:	5b                   	pop    %ebx
  80047b:	5d                   	pop    %ebp
  80047c:	c3                   	ret    

0080047d <readdir>:

struct dirent *
readdir(DIR *dirp) {
  80047d:	f3 0f 1e fb          	endbr32 
  800481:	55                   	push   %ebp
  800482:	89 e5                	mov    %esp,%ebp
  800484:	83 ec 18             	sub    $0x18,%esp
    if (sys_getdirentry(dirp->fd, &(dirp->dirent)) == 0) {
  800487:	8b 45 08             	mov    0x8(%ebp),%eax
  80048a:	8d 50 04             	lea    0x4(%eax),%edx
  80048d:	8b 45 08             	mov    0x8(%ebp),%eax
  800490:	8b 00                	mov    (%eax),%eax
  800492:	89 54 24 04          	mov    %edx,0x4(%esp)
  800496:	89 04 24             	mov    %eax,(%esp)
  800499:	e8 14 ff ff ff       	call   8003b2 <sys_getdirentry>
  80049e:	85 c0                	test   %eax,%eax
  8004a0:	75 08                	jne    8004aa <readdir+0x2d>
        return &(dirp->dirent);
  8004a2:	8b 45 08             	mov    0x8(%ebp),%eax
  8004a5:	83 c0 04             	add    $0x4,%eax
  8004a8:	eb 05                	jmp    8004af <readdir+0x32>
    }
    return NULL;
  8004aa:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8004af:	c9                   	leave  
  8004b0:	c3                   	ret    

008004b1 <closedir>:

void
closedir(DIR *dirp) {
  8004b1:	f3 0f 1e fb          	endbr32 
  8004b5:	55                   	push   %ebp
  8004b6:	89 e5                	mov    %esp,%ebp
  8004b8:	83 ec 18             	sub    $0x18,%esp
    close(dirp->fd);
  8004bb:	8b 45 08             	mov    0x8(%ebp),%eax
  8004be:	8b 00                	mov    (%eax),%eax
  8004c0:	89 04 24             	mov    %eax,(%esp)
  8004c3:	e8 57 00 00 00       	call   80051f <close>
}
  8004c8:	90                   	nop
  8004c9:	c9                   	leave  
  8004ca:	c3                   	ret    

008004cb <getcwd>:

int
getcwd(char *buffer, size_t len) {
  8004cb:	f3 0f 1e fb          	endbr32 
  8004cf:	55                   	push   %ebp
  8004d0:	89 e5                	mov    %esp,%ebp
  8004d2:	83 ec 18             	sub    $0x18,%esp
    return sys_getcwd(buffer, len);
  8004d5:	8b 45 0c             	mov    0xc(%ebp),%eax
  8004d8:	89 44 24 04          	mov    %eax,0x4(%esp)
  8004dc:	8b 45 08             	mov    0x8(%ebp),%eax
  8004df:	89 04 24             	mov    %eax,(%esp)
  8004e2:	e8 a5 fe ff ff       	call   80038c <sys_getcwd>
}
  8004e7:	c9                   	leave  
  8004e8:	c3                   	ret    

008004e9 <_start>:
.text
.globl _start
_start:
    # set ebp for backtrace
    movl $0x0, %ebp
  8004e9:	bd 00 00 00 00       	mov    $0x0,%ebp

    # load argc and argv
    movl (%esp), %ebx
  8004ee:	8b 1c 24             	mov    (%esp),%ebx
    lea 0x4(%esp), %ecx
  8004f1:	8d 4c 24 04          	lea    0x4(%esp),%ecx


    # move down the esp register
    # since it may cause page fault in backtrace
    subl $0x20, %esp
  8004f5:	83 ec 20             	sub    $0x20,%esp

    # save argc and argv on stack
    pushl %ecx
  8004f8:	51                   	push   %ecx
    pushl %ebx
  8004f9:	53                   	push   %ebx

    # call user-program function
    call umain
  8004fa:	e8 e1 03 00 00       	call   8008e0 <umain>
1:  jmp 1b
  8004ff:	eb fe                	jmp    8004ff <_start+0x16>

00800501 <open>:
#include <stat.h>
#include <error.h>
#include <unistd.h>

int
open(const char *path, uint32_t open_flags) {
  800501:	f3 0f 1e fb          	endbr32 
  800505:	55                   	push   %ebp
  800506:	89 e5                	mov    %esp,%ebp
  800508:	83 ec 18             	sub    $0x18,%esp
    return sys_open(path, open_flags);
  80050b:	8b 45 0c             	mov    0xc(%ebp),%eax
  80050e:	89 44 24 04          	mov    %eax,0x4(%esp)
  800512:	8b 45 08             	mov    0x8(%ebp),%eax
  800515:	89 04 24             	mov    %eax,(%esp)
  800518:	e8 5e fd ff ff       	call   80027b <sys_open>
}
  80051d:	c9                   	leave  
  80051e:	c3                   	ret    

0080051f <close>:

int
close(int fd) {
  80051f:	f3 0f 1e fb          	endbr32 
  800523:	55                   	push   %ebp
  800524:	89 e5                	mov    %esp,%ebp
  800526:	83 ec 18             	sub    $0x18,%esp
    return sys_close(fd);
  800529:	8b 45 08             	mov    0x8(%ebp),%eax
  80052c:	89 04 24             	mov    %eax,(%esp)
  80052f:	e8 6d fd ff ff       	call   8002a1 <sys_close>
}
  800534:	c9                   	leave  
  800535:	c3                   	ret    

00800536 <read>:

int
read(int fd, void *base, size_t len) {
  800536:	f3 0f 1e fb          	endbr32 
  80053a:	55                   	push   %ebp
  80053b:	89 e5                	mov    %esp,%ebp
  80053d:	83 ec 18             	sub    $0x18,%esp
    return sys_read(fd, base, len);
  800540:	8b 45 10             	mov    0x10(%ebp),%eax
  800543:	89 44 24 08          	mov    %eax,0x8(%esp)
  800547:	8b 45 0c             	mov    0xc(%ebp),%eax
  80054a:	89 44 24 04          	mov    %eax,0x4(%esp)
  80054e:	8b 45 08             	mov    0x8(%ebp),%eax
  800551:	89 04 24             	mov    %eax,(%esp)
  800554:	e8 67 fd ff ff       	call   8002c0 <sys_read>
}
  800559:	c9                   	leave  
  80055a:	c3                   	ret    

0080055b <write>:

int
write(int fd, void *base, size_t len) {
  80055b:	f3 0f 1e fb          	endbr32 
  80055f:	55                   	push   %ebp
  800560:	89 e5                	mov    %esp,%ebp
  800562:	83 ec 18             	sub    $0x18,%esp
    return sys_write(fd, base, len);
  800565:	8b 45 10             	mov    0x10(%ebp),%eax
  800568:	89 44 24 08          	mov    %eax,0x8(%esp)
  80056c:	8b 45 0c             	mov    0xc(%ebp),%eax
  80056f:	89 44 24 04          	mov    %eax,0x4(%esp)
  800573:	8b 45 08             	mov    0x8(%ebp),%eax
  800576:	89 04 24             	mov    %eax,(%esp)
  800579:	e8 6f fd ff ff       	call   8002ed <sys_write>
}
  80057e:	c9                   	leave  
  80057f:	c3                   	ret    

00800580 <seek>:

int
seek(int fd, off_t pos, int whence) {
  800580:	f3 0f 1e fb          	endbr32 
  800584:	55                   	push   %ebp
  800585:	89 e5                	mov    %esp,%ebp
  800587:	83 ec 18             	sub    $0x18,%esp
    return sys_seek(fd, pos, whence);
  80058a:	8b 45 10             	mov    0x10(%ebp),%eax
  80058d:	89 44 24 08          	mov    %eax,0x8(%esp)
  800591:	8b 45 0c             	mov    0xc(%ebp),%eax
  800594:	89 44 24 04          	mov    %eax,0x4(%esp)
  800598:	8b 45 08             	mov    0x8(%ebp),%eax
  80059b:	89 04 24             	mov    %eax,(%esp)
  80059e:	e8 77 fd ff ff       	call   80031a <sys_seek>
}
  8005a3:	c9                   	leave  
  8005a4:	c3                   	ret    

008005a5 <fstat>:

int
fstat(int fd, struct stat *stat) {
  8005a5:	f3 0f 1e fb          	endbr32 
  8005a9:	55                   	push   %ebp
  8005aa:	89 e5                	mov    %esp,%ebp
  8005ac:	83 ec 18             	sub    $0x18,%esp
    return sys_fstat(fd, stat);
  8005af:	8b 45 0c             	mov    0xc(%ebp),%eax
  8005b2:	89 44 24 04          	mov    %eax,0x4(%esp)
  8005b6:	8b 45 08             	mov    0x8(%ebp),%eax
  8005b9:	89 04 24             	mov    %eax,(%esp)
  8005bc:	e8 86 fd ff ff       	call   800347 <sys_fstat>
}
  8005c1:	c9                   	leave  
  8005c2:	c3                   	ret    

008005c3 <fsync>:

int
fsync(int fd) {
  8005c3:	f3 0f 1e fb          	endbr32 
  8005c7:	55                   	push   %ebp
  8005c8:	89 e5                	mov    %esp,%ebp
  8005ca:	83 ec 18             	sub    $0x18,%esp
    return sys_fsync(fd);
  8005cd:	8b 45 08             	mov    0x8(%ebp),%eax
  8005d0:	89 04 24             	mov    %eax,(%esp)
  8005d3:	e8 95 fd ff ff       	call   80036d <sys_fsync>
}
  8005d8:	c9                   	leave  
  8005d9:	c3                   	ret    

008005da <dup2>:

int
dup2(int fd1, int fd2) {
  8005da:	f3 0f 1e fb          	endbr32 
  8005de:	55                   	push   %ebp
  8005df:	89 e5                	mov    %esp,%ebp
  8005e1:	83 ec 18             	sub    $0x18,%esp
    return sys_dup(fd1, fd2);
  8005e4:	8b 45 0c             	mov    0xc(%ebp),%eax
  8005e7:	89 44 24 04          	mov    %eax,0x4(%esp)
  8005eb:	8b 45 08             	mov    0x8(%ebp),%eax
  8005ee:	89 04 24             	mov    %eax,(%esp)
  8005f1:	e8 e2 fd ff ff       	call   8003d8 <sys_dup>
}
  8005f6:	c9                   	leave  
  8005f7:	c3                   	ret    

008005f8 <transmode>:

static char
transmode(struct stat *stat) {
  8005f8:	f3 0f 1e fb          	endbr32 
  8005fc:	55                   	push   %ebp
  8005fd:	89 e5                	mov    %esp,%ebp
  8005ff:	83 ec 10             	sub    $0x10,%esp
    uint32_t mode = stat->st_mode;
  800602:	8b 45 08             	mov    0x8(%ebp),%eax
  800605:	8b 00                	mov    (%eax),%eax
  800607:	89 45 fc             	mov    %eax,-0x4(%ebp)
    if (S_ISREG(mode)) return 'r';
  80060a:	8b 45 fc             	mov    -0x4(%ebp),%eax
  80060d:	25 00 70 00 00       	and    $0x7000,%eax
  800612:	3d 00 10 00 00       	cmp    $0x1000,%eax
  800617:	75 04                	jne    80061d <transmode+0x25>
  800619:	b0 72                	mov    $0x72,%al
  80061b:	eb 4e                	jmp    80066b <transmode+0x73>
    if (S_ISDIR(mode)) return 'd';
  80061d:	8b 45 fc             	mov    -0x4(%ebp),%eax
  800620:	25 00 70 00 00       	and    $0x7000,%eax
  800625:	3d 00 20 00 00       	cmp    $0x2000,%eax
  80062a:	75 04                	jne    800630 <transmode+0x38>
  80062c:	b0 64                	mov    $0x64,%al
  80062e:	eb 3b                	jmp    80066b <transmode+0x73>
    if (S_ISLNK(mode)) return 'l';
  800630:	8b 45 fc             	mov    -0x4(%ebp),%eax
  800633:	25 00 70 00 00       	and    $0x7000,%eax
  800638:	3d 00 30 00 00       	cmp    $0x3000,%eax
  80063d:	75 04                	jne    800643 <transmode+0x4b>
  80063f:	b0 6c                	mov    $0x6c,%al
  800641:	eb 28                	jmp    80066b <transmode+0x73>
    if (S_ISCHR(mode)) return 'c';
  800643:	8b 45 fc             	mov    -0x4(%ebp),%eax
  800646:	25 00 70 00 00       	and    $0x7000,%eax
  80064b:	3d 00 40 00 00       	cmp    $0x4000,%eax
  800650:	75 04                	jne    800656 <transmode+0x5e>
  800652:	b0 63                	mov    $0x63,%al
  800654:	eb 15                	jmp    80066b <transmode+0x73>
    if (S_ISBLK(mode)) return 'b';
  800656:	8b 45 fc             	mov    -0x4(%ebp),%eax
  800659:	25 00 70 00 00       	and    $0x7000,%eax
  80065e:	3d 00 50 00 00       	cmp    $0x5000,%eax
  800663:	75 04                	jne    800669 <transmode+0x71>
  800665:	b0 62                	mov    $0x62,%al
  800667:	eb 02                	jmp    80066b <transmode+0x73>
    return '-';
  800669:	b0 2d                	mov    $0x2d,%al
}
  80066b:	c9                   	leave  
  80066c:	c3                   	ret    

0080066d <print_stat>:

void
print_stat(const char *name, int fd, struct stat *stat) {
  80066d:	f3 0f 1e fb          	endbr32 
  800671:	55                   	push   %ebp
  800672:	89 e5                	mov    %esp,%ebp
  800674:	83 ec 18             	sub    $0x18,%esp
    cprintf("[%03d] %s\n", fd, name);
  800677:	8b 45 08             	mov    0x8(%ebp),%eax
  80067a:	89 44 24 08          	mov    %eax,0x8(%esp)
  80067e:	8b 45 0c             	mov    0xc(%ebp),%eax
  800681:	89 44 24 04          	mov    %eax,0x4(%esp)
  800685:	c7 04 24 b8 1a 80 00 	movl   $0x801ab8,(%esp)
  80068c:	e8 c7 00 00 00       	call   800758 <cprintf>
    cprintf("    mode    : %c\n", transmode(stat));
  800691:	8b 45 10             	mov    0x10(%ebp),%eax
  800694:	89 04 24             	mov    %eax,(%esp)
  800697:	e8 5c ff ff ff       	call   8005f8 <transmode>
  80069c:	0f be c0             	movsbl %al,%eax
  80069f:	89 44 24 04          	mov    %eax,0x4(%esp)
  8006a3:	c7 04 24 c3 1a 80 00 	movl   $0x801ac3,(%esp)
  8006aa:	e8 a9 00 00 00       	call   800758 <cprintf>
    cprintf("    links   : %lu\n", stat->st_nlinks);
  8006af:	8b 45 10             	mov    0x10(%ebp),%eax
  8006b2:	8b 40 04             	mov    0x4(%eax),%eax
  8006b5:	89 44 24 04          	mov    %eax,0x4(%esp)
  8006b9:	c7 04 24 d5 1a 80 00 	movl   $0x801ad5,(%esp)
  8006c0:	e8 93 00 00 00       	call   800758 <cprintf>
    cprintf("    blocks  : %lu\n", stat->st_blocks);
  8006c5:	8b 45 10             	mov    0x10(%ebp),%eax
  8006c8:	8b 40 08             	mov    0x8(%eax),%eax
  8006cb:	89 44 24 04          	mov    %eax,0x4(%esp)
  8006cf:	c7 04 24 e8 1a 80 00 	movl   $0x801ae8,(%esp)
  8006d6:	e8 7d 00 00 00       	call   800758 <cprintf>
    cprintf("    size    : %lu\n", stat->st_size);
  8006db:	8b 45 10             	mov    0x10(%ebp),%eax
  8006de:	8b 40 0c             	mov    0xc(%eax),%eax
  8006e1:	89 44 24 04          	mov    %eax,0x4(%esp)
  8006e5:	c7 04 24 fb 1a 80 00 	movl   $0x801afb,(%esp)
  8006ec:	e8 67 00 00 00       	call   800758 <cprintf>
}
  8006f1:	90                   	nop
  8006f2:	c9                   	leave  
  8006f3:	c3                   	ret    

008006f4 <cputch>:
/* *
 * cputch - writes a single character @c to stdout, and it will
 * increace the value of counter pointed by @cnt.
 * */
static void
cputch(int c, int *cnt) {
  8006f4:	f3 0f 1e fb          	endbr32 
  8006f8:	55                   	push   %ebp
  8006f9:	89 e5                	mov    %esp,%ebp
  8006fb:	83 ec 18             	sub    $0x18,%esp
    sys_putc(c);
  8006fe:	8b 45 08             	mov    0x8(%ebp),%eax
  800701:	89 04 24             	mov    %eax,(%esp)
  800704:	e8 b7 fa ff ff       	call   8001c0 <sys_putc>
    (*cnt) ++;
  800709:	8b 45 0c             	mov    0xc(%ebp),%eax
  80070c:	8b 00                	mov    (%eax),%eax
  80070e:	8d 50 01             	lea    0x1(%eax),%edx
  800711:	8b 45 0c             	mov    0xc(%ebp),%eax
  800714:	89 10                	mov    %edx,(%eax)
}
  800716:	90                   	nop
  800717:	c9                   	leave  
  800718:	c3                   	ret    

00800719 <vcprintf>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want cprintf() instead.
 * */
int
vcprintf(const char *fmt, va_list ap) {
  800719:	f3 0f 1e fb          	endbr32 
  80071d:	55                   	push   %ebp
  80071e:	89 e5                	mov    %esp,%ebp
  800720:	83 ec 38             	sub    $0x38,%esp
    int cnt = 0;
  800723:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    vprintfmt((void*)cputch, NO_FD, &cnt, fmt, ap);
  80072a:	8b 45 0c             	mov    0xc(%ebp),%eax
  80072d:	89 44 24 10          	mov    %eax,0x10(%esp)
  800731:	8b 45 08             	mov    0x8(%ebp),%eax
  800734:	89 44 24 0c          	mov    %eax,0xc(%esp)
  800738:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80073b:	89 44 24 08          	mov    %eax,0x8(%esp)
  80073f:	c7 44 24 04 d9 6a ff 	movl   $0xffff6ad9,0x4(%esp)
  800746:	ff 
  800747:	c7 04 24 f4 06 80 00 	movl   $0x8006f4,(%esp)
  80074e:	e8 78 0b 00 00       	call   8012cb <vprintfmt>
    return cnt;
  800753:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
  800756:	c9                   	leave  
  800757:	c3                   	ret    

00800758 <cprintf>:
 *
 * The return value is the number of characters which would be
 * written to stdout.
 * */
int
cprintf(const char *fmt, ...) {
  800758:	f3 0f 1e fb          	endbr32 
  80075c:	55                   	push   %ebp
  80075d:	89 e5                	mov    %esp,%ebp
  80075f:	83 ec 28             	sub    $0x28,%esp
    va_list ap;

    va_start(ap, fmt);
  800762:	8d 45 0c             	lea    0xc(%ebp),%eax
  800765:	89 45 f0             	mov    %eax,-0x10(%ebp)
    int cnt = vcprintf(fmt, ap);
  800768:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80076b:	89 44 24 04          	mov    %eax,0x4(%esp)
  80076f:	8b 45 08             	mov    0x8(%ebp),%eax
  800772:	89 04 24             	mov    %eax,(%esp)
  800775:	e8 9f ff ff ff       	call   800719 <vcprintf>
  80077a:	89 45 f4             	mov    %eax,-0xc(%ebp)
    va_end(ap);

    return cnt;
  80077d:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
  800780:	c9                   	leave  
  800781:	c3                   	ret    

00800782 <cputs>:
/* *
 * cputs- writes the string pointed by @str to stdout and
 * appends a newline character.
 * */
int
cputs(const char *str) {
  800782:	f3 0f 1e fb          	endbr32 
  800786:	55                   	push   %ebp
  800787:	89 e5                	mov    %esp,%ebp
  800789:	83 ec 28             	sub    $0x28,%esp
    int cnt = 0;
  80078c:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    char c;
    while ((c = *str ++) != '\0') {
  800793:	eb 13                	jmp    8007a8 <cputs+0x26>
        cputch(c, &cnt);
  800795:	0f be 45 f7          	movsbl -0x9(%ebp),%eax
  800799:	8d 55 f0             	lea    -0x10(%ebp),%edx
  80079c:	89 54 24 04          	mov    %edx,0x4(%esp)
  8007a0:	89 04 24             	mov    %eax,(%esp)
  8007a3:	e8 4c ff ff ff       	call   8006f4 <cputch>
    while ((c = *str ++) != '\0') {
  8007a8:	8b 45 08             	mov    0x8(%ebp),%eax
  8007ab:	8d 50 01             	lea    0x1(%eax),%edx
  8007ae:	89 55 08             	mov    %edx,0x8(%ebp)
  8007b1:	0f b6 00             	movzbl (%eax),%eax
  8007b4:	88 45 f7             	mov    %al,-0x9(%ebp)
  8007b7:	80 7d f7 00          	cmpb   $0x0,-0x9(%ebp)
  8007bb:	75 d8                	jne    800795 <cputs+0x13>
    }
    cputch('\n', &cnt);
  8007bd:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8007c0:	89 44 24 04          	mov    %eax,0x4(%esp)
  8007c4:	c7 04 24 0a 00 00 00 	movl   $0xa,(%esp)
  8007cb:	e8 24 ff ff ff       	call   8006f4 <cputch>
    return cnt;
  8007d0:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
  8007d3:	c9                   	leave  
  8007d4:	c3                   	ret    

008007d5 <fputch>:


static void
fputch(char c, int *cnt, int fd) {
  8007d5:	f3 0f 1e fb          	endbr32 
  8007d9:	55                   	push   %ebp
  8007da:	89 e5                	mov    %esp,%ebp
  8007dc:	83 ec 28             	sub    $0x28,%esp
  8007df:	8b 45 08             	mov    0x8(%ebp),%eax
  8007e2:	88 45 f4             	mov    %al,-0xc(%ebp)
    write(fd, &c, sizeof(char));
  8007e5:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
  8007ec:	00 
  8007ed:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8007f0:	89 44 24 04          	mov    %eax,0x4(%esp)
  8007f4:	8b 45 10             	mov    0x10(%ebp),%eax
  8007f7:	89 04 24             	mov    %eax,(%esp)
  8007fa:	e8 5c fd ff ff       	call   80055b <write>
    (*cnt) ++;
  8007ff:	8b 45 0c             	mov    0xc(%ebp),%eax
  800802:	8b 00                	mov    (%eax),%eax
  800804:	8d 50 01             	lea    0x1(%eax),%edx
  800807:	8b 45 0c             	mov    0xc(%ebp),%eax
  80080a:	89 10                	mov    %edx,(%eax)
}
  80080c:	90                   	nop
  80080d:	c9                   	leave  
  80080e:	c3                   	ret    

0080080f <vfprintf>:

int
vfprintf(int fd, const char *fmt, va_list ap) {
  80080f:	f3 0f 1e fb          	endbr32 
  800813:	55                   	push   %ebp
  800814:	89 e5                	mov    %esp,%ebp
  800816:	83 ec 38             	sub    $0x38,%esp
    int cnt = 0;
  800819:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    vprintfmt((void*)fputch, fd, &cnt, fmt, ap);
  800820:	8b 45 10             	mov    0x10(%ebp),%eax
  800823:	89 44 24 10          	mov    %eax,0x10(%esp)
  800827:	8b 45 0c             	mov    0xc(%ebp),%eax
  80082a:	89 44 24 0c          	mov    %eax,0xc(%esp)
  80082e:	8d 45 f4             	lea    -0xc(%ebp),%eax
  800831:	89 44 24 08          	mov    %eax,0x8(%esp)
  800835:	8b 45 08             	mov    0x8(%ebp),%eax
  800838:	89 44 24 04          	mov    %eax,0x4(%esp)
  80083c:	c7 04 24 d5 07 80 00 	movl   $0x8007d5,(%esp)
  800843:	e8 83 0a 00 00       	call   8012cb <vprintfmt>
    return cnt;
  800848:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
  80084b:	c9                   	leave  
  80084c:	c3                   	ret    

0080084d <fprintf>:

int
fprintf(int fd, const char *fmt, ...) {
  80084d:	f3 0f 1e fb          	endbr32 
  800851:	55                   	push   %ebp
  800852:	89 e5                	mov    %esp,%ebp
  800854:	83 ec 28             	sub    $0x28,%esp
    va_list ap;

    va_start(ap, fmt);
  800857:	8d 45 10             	lea    0x10(%ebp),%eax
  80085a:	89 45 f0             	mov    %eax,-0x10(%ebp)
    int cnt = vfprintf(fd, fmt, ap);
  80085d:	8b 45 f0             	mov    -0x10(%ebp),%eax
  800860:	89 44 24 08          	mov    %eax,0x8(%esp)
  800864:	8b 45 0c             	mov    0xc(%ebp),%eax
  800867:	89 44 24 04          	mov    %eax,0x4(%esp)
  80086b:	8b 45 08             	mov    0x8(%ebp),%eax
  80086e:	89 04 24             	mov    %eax,(%esp)
  800871:	e8 99 ff ff ff       	call   80080f <vfprintf>
  800876:	89 45 f4             	mov    %eax,-0xc(%ebp)
    va_end(ap);

    return cnt;
  800879:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
  80087c:	c9                   	leave  
  80087d:	c3                   	ret    

0080087e <initfd>:
#include <stat.h>

int main(int argc, char *argv[]);

static int
initfd(int fd2, const char *path, uint32_t open_flags) {
  80087e:	f3 0f 1e fb          	endbr32 
  800882:	55                   	push   %ebp
  800883:	89 e5                	mov    %esp,%ebp
  800885:	83 ec 28             	sub    $0x28,%esp
    int fd1, ret;
    if ((fd1 = open(path, open_flags)) < 0) {
  800888:	8b 45 10             	mov    0x10(%ebp),%eax
  80088b:	89 44 24 04          	mov    %eax,0x4(%esp)
  80088f:	8b 45 0c             	mov    0xc(%ebp),%eax
  800892:	89 04 24             	mov    %eax,(%esp)
  800895:	e8 67 fc ff ff       	call   800501 <open>
  80089a:	89 45 f0             	mov    %eax,-0x10(%ebp)
  80089d:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
  8008a1:	79 05                	jns    8008a8 <initfd+0x2a>
        return fd1;
  8008a3:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8008a6:	eb 36                	jmp    8008de <initfd+0x60>
    }
    if (fd1 != fd2) {
  8008a8:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8008ab:	3b 45 08             	cmp    0x8(%ebp),%eax
  8008ae:	74 2b                	je     8008db <initfd+0x5d>
        close(fd2);
  8008b0:	8b 45 08             	mov    0x8(%ebp),%eax
  8008b3:	89 04 24             	mov    %eax,(%esp)
  8008b6:	e8 64 fc ff ff       	call   80051f <close>
        ret = dup2(fd1, fd2);
  8008bb:	8b 45 08             	mov    0x8(%ebp),%eax
  8008be:	89 44 24 04          	mov    %eax,0x4(%esp)
  8008c2:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8008c5:	89 04 24             	mov    %eax,(%esp)
  8008c8:	e8 0d fd ff ff       	call   8005da <dup2>
  8008cd:	89 45 f4             	mov    %eax,-0xc(%ebp)
        close(fd1);
  8008d0:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8008d3:	89 04 24             	mov    %eax,(%esp)
  8008d6:	e8 44 fc ff ff       	call   80051f <close>
    }
    return ret;
  8008db:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
  8008de:	c9                   	leave  
  8008df:	c3                   	ret    

008008e0 <umain>:

void
umain(int argc, char *argv[]) {
  8008e0:	f3 0f 1e fb          	endbr32 
  8008e4:	55                   	push   %ebp
  8008e5:	89 e5                	mov    %esp,%ebp
  8008e7:	83 ec 28             	sub    $0x28,%esp
    int fd;
    if ((fd = initfd(0, "stdin:", O_RDONLY)) < 0) {
  8008ea:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
  8008f1:	00 
  8008f2:	c7 44 24 04 0e 1b 80 	movl   $0x801b0e,0x4(%esp)
  8008f9:	00 
  8008fa:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  800901:	e8 78 ff ff ff       	call   80087e <initfd>
  800906:	89 45 f4             	mov    %eax,-0xc(%ebp)
  800909:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
  80090d:	79 23                	jns    800932 <umain+0x52>
        warn("open <stdin> failed: %e.\n", fd);
  80090f:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800912:	89 44 24 0c          	mov    %eax,0xc(%esp)
  800916:	c7 44 24 08 15 1b 80 	movl   $0x801b15,0x8(%esp)
  80091d:	00 
  80091e:	c7 44 24 04 1a 00 00 	movl   $0x1a,0x4(%esp)
  800925:	00 
  800926:	c7 04 24 2f 1b 80 00 	movl   $0x801b2f,(%esp)
  80092d:	e8 42 f7 ff ff       	call   800074 <__warn>
    }
    if ((fd = initfd(1, "stdout:", O_WRONLY)) < 0) {
  800932:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
  800939:	00 
  80093a:	c7 44 24 04 41 1b 80 	movl   $0x801b41,0x4(%esp)
  800941:	00 
  800942:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  800949:	e8 30 ff ff ff       	call   80087e <initfd>
  80094e:	89 45 f4             	mov    %eax,-0xc(%ebp)
  800951:	83 7d f4 00          	cmpl   $0x0,-0xc(%ebp)
  800955:	79 23                	jns    80097a <umain+0x9a>
        warn("open <stdout> failed: %e.\n", fd);
  800957:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80095a:	89 44 24 0c          	mov    %eax,0xc(%esp)
  80095e:	c7 44 24 08 49 1b 80 	movl   $0x801b49,0x8(%esp)
  800965:	00 
  800966:	c7 44 24 04 1d 00 00 	movl   $0x1d,0x4(%esp)
  80096d:	00 
  80096e:	c7 04 24 2f 1b 80 00 	movl   $0x801b2f,(%esp)
  800975:	e8 fa f6 ff ff       	call   800074 <__warn>
    }
    int ret = main(argc, argv);
  80097a:	8b 45 0c             	mov    0xc(%ebp),%eax
  80097d:	89 44 24 04          	mov    %eax,0x4(%esp)
  800981:	8b 45 08             	mov    0x8(%ebp),%eax
  800984:	89 04 24             	mov    %eax,(%esp)
  800987:	e8 72 0f 00 00       	call   8018fe <main>
  80098c:	89 45 f0             	mov    %eax,-0x10(%ebp)
    exit(ret);
  80098f:	8b 45 f0             	mov    -0x10(%ebp),%eax
  800992:	89 04 24             	mov    %eax,(%esp)
  800995:	e8 f8 00 00 00       	call   800a92 <exit>

0080099a <test_and_set_bit>:
 * test_and_set_bit - Atomically set a bit and return its old value
 * @nr:     the bit to set
 * @addr:   the address to count from
 * */
static inline bool
test_and_set_bit(int nr, volatile void *addr) {
  80099a:	55                   	push   %ebp
  80099b:	89 e5                	mov    %esp,%ebp
  80099d:	83 ec 10             	sub    $0x10,%esp
    int oldbit;
    asm volatile ("btsl %2, %1; sbbl %0, %0" : "=r" (oldbit), "=m" (*(volatile long *)addr) : "Ir" (nr) : "memory");
  8009a0:	8b 55 0c             	mov    0xc(%ebp),%edx
  8009a3:	8b 45 08             	mov    0x8(%ebp),%eax
  8009a6:	0f ab 02             	bts    %eax,(%edx)
  8009a9:	19 c0                	sbb    %eax,%eax
  8009ab:	89 45 fc             	mov    %eax,-0x4(%ebp)
    return oldbit != 0;
  8009ae:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
  8009b2:	0f 95 c0             	setne  %al
  8009b5:	0f b6 c0             	movzbl %al,%eax
}
  8009b8:	c9                   	leave  
  8009b9:	c3                   	ret    

008009ba <test_and_clear_bit>:
 * test_and_clear_bit - Atomically clear a bit and return its old value
 * @nr:     the bit to clear
 * @addr:   the address to count from
 * */
static inline bool
test_and_clear_bit(int nr, volatile void *addr) {
  8009ba:	55                   	push   %ebp
  8009bb:	89 e5                	mov    %esp,%ebp
  8009bd:	83 ec 10             	sub    $0x10,%esp
    int oldbit;
    asm volatile ("btrl %2, %1; sbbl %0, %0" : "=r" (oldbit), "=m" (*(volatile long *)addr) : "Ir" (nr) : "memory");
  8009c0:	8b 55 0c             	mov    0xc(%ebp),%edx
  8009c3:	8b 45 08             	mov    0x8(%ebp),%eax
  8009c6:	0f b3 02             	btr    %eax,(%edx)
  8009c9:	19 c0                	sbb    %eax,%eax
  8009cb:	89 45 fc             	mov    %eax,-0x4(%ebp)
    return oldbit != 0;
  8009ce:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
  8009d2:	0f 95 c0             	setne  %al
  8009d5:	0f b6 c0             	movzbl %al,%eax
}
  8009d8:	c9                   	leave  
  8009d9:	c3                   	ret    

008009da <try_lock>:
lock_init(lock_t *l) {
    *l = 0;
}

static inline bool
try_lock(lock_t *l) {
  8009da:	55                   	push   %ebp
  8009db:	89 e5                	mov    %esp,%ebp
  8009dd:	83 ec 08             	sub    $0x8,%esp
    return test_and_set_bit(0, l);
  8009e0:	8b 45 08             	mov    0x8(%ebp),%eax
  8009e3:	89 44 24 04          	mov    %eax,0x4(%esp)
  8009e7:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  8009ee:	e8 a7 ff ff ff       	call   80099a <test_and_set_bit>
}
  8009f3:	c9                   	leave  
  8009f4:	c3                   	ret    

008009f5 <lock>:

static inline void
lock(lock_t *l) {
  8009f5:	55                   	push   %ebp
  8009f6:	89 e5                	mov    %esp,%ebp
  8009f8:	83 ec 28             	sub    $0x28,%esp
    if (try_lock(l)) {
  8009fb:	8b 45 08             	mov    0x8(%ebp),%eax
  8009fe:	89 04 24             	mov    %eax,(%esp)
  800a01:	e8 d4 ff ff ff       	call   8009da <try_lock>
  800a06:	85 c0                	test   %eax,%eax
  800a08:	74 37                	je     800a41 <lock+0x4c>
        int step = 0;
  800a0a:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
        do {
            yield();
  800a11:	e8 ee 00 00 00       	call   800b04 <yield>
            if (++ step == 100) {
  800a16:	ff 45 f4             	incl   -0xc(%ebp)
  800a19:	83 7d f4 64          	cmpl   $0x64,-0xc(%ebp)
  800a1d:	75 13                	jne    800a32 <lock+0x3d>
                step = 0;
  800a1f:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
                sleep(10);
  800a26:	c7 04 24 0a 00 00 00 	movl   $0xa,(%esp)
  800a2d:	e8 36 01 00 00       	call   800b68 <sleep>
            }
        } while (try_lock(l));
  800a32:	8b 45 08             	mov    0x8(%ebp),%eax
  800a35:	89 04 24             	mov    %eax,(%esp)
  800a38:	e8 9d ff ff ff       	call   8009da <try_lock>
  800a3d:	85 c0                	test   %eax,%eax
  800a3f:	75 d0                	jne    800a11 <lock+0x1c>
    }
}
  800a41:	90                   	nop
  800a42:	c9                   	leave  
  800a43:	c3                   	ret    

00800a44 <unlock>:

static inline void
unlock(lock_t *l) {
  800a44:	55                   	push   %ebp
  800a45:	89 e5                	mov    %esp,%ebp
  800a47:	83 ec 08             	sub    $0x8,%esp
    test_and_clear_bit(0, l);
  800a4a:	8b 45 08             	mov    0x8(%ebp),%eax
  800a4d:	89 44 24 04          	mov    %eax,0x4(%esp)
  800a51:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  800a58:	e8 5d ff ff ff       	call   8009ba <test_and_clear_bit>
}
  800a5d:	90                   	nop
  800a5e:	c9                   	leave  
  800a5f:	c3                   	ret    

00800a60 <lock_fork>:
#include <lock.h>

static lock_t fork_lock = INIT_LOCK;

void
lock_fork(void) {
  800a60:	f3 0f 1e fb          	endbr32 
  800a64:	55                   	push   %ebp
  800a65:	89 e5                	mov    %esp,%ebp
  800a67:	83 ec 18             	sub    $0x18,%esp
    lock(&fork_lock);
  800a6a:	c7 04 24 20 30 80 00 	movl   $0x803020,(%esp)
  800a71:	e8 7f ff ff ff       	call   8009f5 <lock>
}
  800a76:	90                   	nop
  800a77:	c9                   	leave  
  800a78:	c3                   	ret    

00800a79 <unlock_fork>:

void
unlock_fork(void) {
  800a79:	f3 0f 1e fb          	endbr32 
  800a7d:	55                   	push   %ebp
  800a7e:	89 e5                	mov    %esp,%ebp
  800a80:	83 ec 04             	sub    $0x4,%esp
    unlock(&fork_lock);
  800a83:	c7 04 24 20 30 80 00 	movl   $0x803020,(%esp)
  800a8a:	e8 b5 ff ff ff       	call   800a44 <unlock>
}
  800a8f:	90                   	nop
  800a90:	c9                   	leave  
  800a91:	c3                   	ret    

00800a92 <exit>:

void
exit(int error_code) {
  800a92:	f3 0f 1e fb          	endbr32 
  800a96:	55                   	push   %ebp
  800a97:	89 e5                	mov    %esp,%ebp
  800a99:	83 ec 18             	sub    $0x18,%esp
    sys_exit(error_code);
  800a9c:	8b 45 08             	mov    0x8(%ebp),%eax
  800a9f:	89 04 24             	mov    %eax,(%esp)
  800aa2:	e8 6d f6 ff ff       	call   800114 <sys_exit>
    cprintf("BUG: exit failed.\n");
  800aa7:	c7 04 24 64 1b 80 00 	movl   $0x801b64,(%esp)
  800aae:	e8 a5 fc ff ff       	call   800758 <cprintf>
    while (1);
  800ab3:	eb fe                	jmp    800ab3 <exit+0x21>

00800ab5 <fork>:
}

int
fork(void) {
  800ab5:	f3 0f 1e fb          	endbr32 
  800ab9:	55                   	push   %ebp
  800aba:	89 e5                	mov    %esp,%ebp
  800abc:	83 ec 08             	sub    $0x8,%esp
    return sys_fork();
  800abf:	e8 6f f6 ff ff       	call   800133 <sys_fork>
}
  800ac4:	c9                   	leave  
  800ac5:	c3                   	ret    

00800ac6 <wait>:

int
wait(void) {
  800ac6:	f3 0f 1e fb          	endbr32 
  800aca:	55                   	push   %ebp
  800acb:	89 e5                	mov    %esp,%ebp
  800acd:	83 ec 18             	sub    $0x18,%esp
    return sys_wait(0, NULL);
  800ad0:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
  800ad7:	00 
  800ad8:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  800adf:	e8 67 f6 ff ff       	call   80014b <sys_wait>
}
  800ae4:	c9                   	leave  
  800ae5:	c3                   	ret    

00800ae6 <waitpid>:

int
waitpid(int pid, int *store) {
  800ae6:	f3 0f 1e fb          	endbr32 
  800aea:	55                   	push   %ebp
  800aeb:	89 e5                	mov    %esp,%ebp
  800aed:	83 ec 18             	sub    $0x18,%esp
    return sys_wait(pid, store);
  800af0:	8b 45 0c             	mov    0xc(%ebp),%eax
  800af3:	89 44 24 04          	mov    %eax,0x4(%esp)
  800af7:	8b 45 08             	mov    0x8(%ebp),%eax
  800afa:	89 04 24             	mov    %eax,(%esp)
  800afd:	e8 49 f6 ff ff       	call   80014b <sys_wait>
}
  800b02:	c9                   	leave  
  800b03:	c3                   	ret    

00800b04 <yield>:

void
yield(void) {
  800b04:	f3 0f 1e fb          	endbr32 
  800b08:	55                   	push   %ebp
  800b09:	89 e5                	mov    %esp,%ebp
  800b0b:	83 ec 08             	sub    $0x8,%esp
    sys_yield();
  800b0e:	e8 5e f6 ff ff       	call   800171 <sys_yield>
}
  800b13:	90                   	nop
  800b14:	c9                   	leave  
  800b15:	c3                   	ret    

00800b16 <kill>:

int
kill(int pid) {
  800b16:	f3 0f 1e fb          	endbr32 
  800b1a:	55                   	push   %ebp
  800b1b:	89 e5                	mov    %esp,%ebp
  800b1d:	83 ec 18             	sub    $0x18,%esp
    return sys_kill(pid);
  800b20:	8b 45 08             	mov    0x8(%ebp),%eax
  800b23:	89 04 24             	mov    %eax,(%esp)
  800b26:	e8 5e f6 ff ff       	call   800189 <sys_kill>
}
  800b2b:	c9                   	leave  
  800b2c:	c3                   	ret    

00800b2d <getpid>:

int
getpid(void) {
  800b2d:	f3 0f 1e fb          	endbr32 
  800b31:	55                   	push   %ebp
  800b32:	89 e5                	mov    %esp,%ebp
  800b34:	83 ec 08             	sub    $0x8,%esp
    return sys_getpid();
  800b37:	e8 6c f6 ff ff       	call   8001a8 <sys_getpid>
}
  800b3c:	c9                   	leave  
  800b3d:	c3                   	ret    

00800b3e <print_pgdir>:

//print_pgdir - print the PDT&PT
void
print_pgdir(void) {
  800b3e:	f3 0f 1e fb          	endbr32 
  800b42:	55                   	push   %ebp
  800b43:	89 e5                	mov    %esp,%ebp
  800b45:	83 ec 08             	sub    $0x8,%esp
    sys_pgdir();
  800b48:	e8 92 f6 ff ff       	call   8001df <sys_pgdir>
}
  800b4d:	90                   	nop
  800b4e:	c9                   	leave  
  800b4f:	c3                   	ret    

00800b50 <lab6_set_priority>:

void
lab6_set_priority(uint32_t priority)
{
  800b50:	f3 0f 1e fb          	endbr32 
  800b54:	55                   	push   %ebp
  800b55:	89 e5                	mov    %esp,%ebp
  800b57:	83 ec 18             	sub    $0x18,%esp
    sys_lab6_set_priority(priority);
  800b5a:	8b 45 08             	mov    0x8(%ebp),%eax
  800b5d:	89 04 24             	mov    %eax,(%esp)
  800b60:	e8 92 f6 ff ff       	call   8001f7 <sys_lab6_set_priority>
}
  800b65:	90                   	nop
  800b66:	c9                   	leave  
  800b67:	c3                   	ret    

00800b68 <sleep>:

int
sleep(unsigned int time) {
  800b68:	f3 0f 1e fb          	endbr32 
  800b6c:	55                   	push   %ebp
  800b6d:	89 e5                	mov    %esp,%ebp
  800b6f:	83 ec 18             	sub    $0x18,%esp
    return sys_sleep(time);
  800b72:	8b 45 08             	mov    0x8(%ebp),%eax
  800b75:	89 04 24             	mov    %eax,(%esp)
  800b78:	e8 9a f6 ff ff       	call   800217 <sys_sleep>
}
  800b7d:	c9                   	leave  
  800b7e:	c3                   	ret    

00800b7f <gettime_msec>:

unsigned int
gettime_msec(void) {
  800b7f:	f3 0f 1e fb          	endbr32 
  800b83:	55                   	push   %ebp
  800b84:	89 e5                	mov    %esp,%ebp
  800b86:	83 ec 08             	sub    $0x8,%esp
    return (unsigned int)sys_gettime();
  800b89:	e8 a8 f6 ff ff       	call   800236 <sys_gettime>
}
  800b8e:	c9                   	leave  
  800b8f:	c3                   	ret    

00800b90 <__exec>:

int
__exec(const char *name, const char **argv) {
  800b90:	f3 0f 1e fb          	endbr32 
  800b94:	55                   	push   %ebp
  800b95:	89 e5                	mov    %esp,%ebp
  800b97:	83 ec 28             	sub    $0x28,%esp
    int argc = 0;
  800b9a:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    while (argv[argc] != NULL) {
  800ba1:	eb 03                	jmp    800ba6 <__exec+0x16>
        argc ++;
  800ba3:	ff 45 f4             	incl   -0xc(%ebp)
    while (argv[argc] != NULL) {
  800ba6:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800ba9:	8d 14 85 00 00 00 00 	lea    0x0(,%eax,4),%edx
  800bb0:	8b 45 0c             	mov    0xc(%ebp),%eax
  800bb3:	01 d0                	add    %edx,%eax
  800bb5:	8b 00                	mov    (%eax),%eax
  800bb7:	85 c0                	test   %eax,%eax
  800bb9:	75 e8                	jne    800ba3 <__exec+0x13>
    }
    return sys_exec(name, argc, argv);
  800bbb:	8b 45 0c             	mov    0xc(%ebp),%eax
  800bbe:	89 44 24 08          	mov    %eax,0x8(%esp)
  800bc2:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800bc5:	89 44 24 04          	mov    %eax,0x4(%esp)
  800bc9:	8b 45 08             	mov    0x8(%ebp),%eax
  800bcc:	89 04 24             	mov    %eax,(%esp)
  800bcf:	e8 7a f6 ff ff       	call   80024e <sys_exec>
}
  800bd4:	c9                   	leave  
  800bd5:	c3                   	ret    

00800bd6 <strlen>:
 * @s:      the input string
 *
 * The strlen() function returns the length of string @s.
 * */
size_t
strlen(const char *s) {
  800bd6:	f3 0f 1e fb          	endbr32 
  800bda:	55                   	push   %ebp
  800bdb:	89 e5                	mov    %esp,%ebp
  800bdd:	83 ec 10             	sub    $0x10,%esp
    size_t cnt = 0;
  800be0:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    while (*s ++ != '\0') {
  800be7:	eb 03                	jmp    800bec <strlen+0x16>
        cnt ++;
  800be9:	ff 45 fc             	incl   -0x4(%ebp)
    while (*s ++ != '\0') {
  800bec:	8b 45 08             	mov    0x8(%ebp),%eax
  800bef:	8d 50 01             	lea    0x1(%eax),%edx
  800bf2:	89 55 08             	mov    %edx,0x8(%ebp)
  800bf5:	0f b6 00             	movzbl (%eax),%eax
  800bf8:	84 c0                	test   %al,%al
  800bfa:	75 ed                	jne    800be9 <strlen+0x13>
    }
    return cnt;
  800bfc:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
  800bff:	c9                   	leave  
  800c00:	c3                   	ret    

00800c01 <strnlen>:
 * The return value is strlen(s), if that is less than @len, or
 * @len if there is no '\0' character among the first @len characters
 * pointed by @s.
 * */
size_t
strnlen(const char *s, size_t len) {
  800c01:	f3 0f 1e fb          	endbr32 
  800c05:	55                   	push   %ebp
  800c06:	89 e5                	mov    %esp,%ebp
  800c08:	83 ec 10             	sub    $0x10,%esp
    size_t cnt = 0;
  800c0b:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    while (cnt < len && *s ++ != '\0') {
  800c12:	eb 03                	jmp    800c17 <strnlen+0x16>
        cnt ++;
  800c14:	ff 45 fc             	incl   -0x4(%ebp)
    while (cnt < len && *s ++ != '\0') {
  800c17:	8b 45 fc             	mov    -0x4(%ebp),%eax
  800c1a:	3b 45 0c             	cmp    0xc(%ebp),%eax
  800c1d:	73 10                	jae    800c2f <strnlen+0x2e>
  800c1f:	8b 45 08             	mov    0x8(%ebp),%eax
  800c22:	8d 50 01             	lea    0x1(%eax),%edx
  800c25:	89 55 08             	mov    %edx,0x8(%ebp)
  800c28:	0f b6 00             	movzbl (%eax),%eax
  800c2b:	84 c0                	test   %al,%al
  800c2d:	75 e5                	jne    800c14 <strnlen+0x13>
    }
    return cnt;
  800c2f:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
  800c32:	c9                   	leave  
  800c33:	c3                   	ret    

00800c34 <strcat>:
 * @dst:    pointer to the @dst array, which should be large enough to contain the concatenated
 *          resulting string.
 * @src:    string to be appended, this should not overlap @dst
 * */
char *
strcat(char *dst, const char *src) {
  800c34:	f3 0f 1e fb          	endbr32 
  800c38:	55                   	push   %ebp
  800c39:	89 e5                	mov    %esp,%ebp
  800c3b:	83 ec 18             	sub    $0x18,%esp
    return strcpy(dst + strlen(dst), src);
  800c3e:	8b 45 08             	mov    0x8(%ebp),%eax
  800c41:	89 04 24             	mov    %eax,(%esp)
  800c44:	e8 8d ff ff ff       	call   800bd6 <strlen>
  800c49:	8b 55 08             	mov    0x8(%ebp),%edx
  800c4c:	01 c2                	add    %eax,%edx
  800c4e:	8b 45 0c             	mov    0xc(%ebp),%eax
  800c51:	89 44 24 04          	mov    %eax,0x4(%esp)
  800c55:	89 14 24             	mov    %edx,(%esp)
  800c58:	e8 02 00 00 00       	call   800c5f <strcpy>
}
  800c5d:	c9                   	leave  
  800c5e:	c3                   	ret    

00800c5f <strcpy>:
 * To avoid overflows, the size of array pointed by @dst should be long enough to
 * contain the same string as @src (including the terminating null character), and
 * should not overlap in memory with @src.
 * */
char *
strcpy(char *dst, const char *src) {
  800c5f:	f3 0f 1e fb          	endbr32 
  800c63:	55                   	push   %ebp
  800c64:	89 e5                	mov    %esp,%ebp
  800c66:	57                   	push   %edi
  800c67:	56                   	push   %esi
  800c68:	83 ec 20             	sub    $0x20,%esp
  800c6b:	8b 45 08             	mov    0x8(%ebp),%eax
  800c6e:	89 45 f4             	mov    %eax,-0xc(%ebp)
  800c71:	8b 45 0c             	mov    0xc(%ebp),%eax
  800c74:	89 45 f0             	mov    %eax,-0x10(%ebp)
#ifndef __HAVE_ARCH_STRCPY
#define __HAVE_ARCH_STRCPY
static inline char *
__strcpy(char *dst, const char *src) {
    int d0, d1, d2;
    asm volatile (
  800c77:	8b 55 f0             	mov    -0x10(%ebp),%edx
  800c7a:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800c7d:	89 d1                	mov    %edx,%ecx
  800c7f:	89 c2                	mov    %eax,%edx
  800c81:	89 ce                	mov    %ecx,%esi
  800c83:	89 d7                	mov    %edx,%edi
  800c85:	ac                   	lods   %ds:(%esi),%al
  800c86:	aa                   	stos   %al,%es:(%edi)
  800c87:	84 c0                	test   %al,%al
  800c89:	75 fa                	jne    800c85 <strcpy+0x26>
  800c8b:	89 fa                	mov    %edi,%edx
  800c8d:	89 f1                	mov    %esi,%ecx
  800c8f:	89 4d ec             	mov    %ecx,-0x14(%ebp)
  800c92:	89 55 e8             	mov    %edx,-0x18(%ebp)
  800c95:	89 45 e4             	mov    %eax,-0x1c(%ebp)
        "stosb;"
        "testb %%al, %%al;"
        "jne 1b;"
        : "=&S" (d0), "=&D" (d1), "=&a" (d2)
        : "0" (src), "1" (dst) : "memory");
    return dst;
  800c98:	8b 45 f4             	mov    -0xc(%ebp),%eax
    char *p = dst;
    while ((*p ++ = *src ++) != '\0')
        /* nothing */;
    return dst;
#endif /* __HAVE_ARCH_STRCPY */
}
  800c9b:	83 c4 20             	add    $0x20,%esp
  800c9e:	5e                   	pop    %esi
  800c9f:	5f                   	pop    %edi
  800ca0:	5d                   	pop    %ebp
  800ca1:	c3                   	ret    

00800ca2 <strncpy>:
 * @len:    maximum number of characters to be copied from @src
 *
 * The return value is @dst
 * */
char *
strncpy(char *dst, const char *src, size_t len) {
  800ca2:	f3 0f 1e fb          	endbr32 
  800ca6:	55                   	push   %ebp
  800ca7:	89 e5                	mov    %esp,%ebp
  800ca9:	83 ec 10             	sub    $0x10,%esp
    char *p = dst;
  800cac:	8b 45 08             	mov    0x8(%ebp),%eax
  800caf:	89 45 fc             	mov    %eax,-0x4(%ebp)
    while (len > 0) {
  800cb2:	eb 1e                	jmp    800cd2 <strncpy+0x30>
        if ((*p = *src) != '\0') {
  800cb4:	8b 45 0c             	mov    0xc(%ebp),%eax
  800cb7:	0f b6 10             	movzbl (%eax),%edx
  800cba:	8b 45 fc             	mov    -0x4(%ebp),%eax
  800cbd:	88 10                	mov    %dl,(%eax)
  800cbf:	8b 45 fc             	mov    -0x4(%ebp),%eax
  800cc2:	0f b6 00             	movzbl (%eax),%eax
  800cc5:	84 c0                	test   %al,%al
  800cc7:	74 03                	je     800ccc <strncpy+0x2a>
            src ++;
  800cc9:	ff 45 0c             	incl   0xc(%ebp)
        }
        p ++, len --;
  800ccc:	ff 45 fc             	incl   -0x4(%ebp)
  800ccf:	ff 4d 10             	decl   0x10(%ebp)
    while (len > 0) {
  800cd2:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  800cd6:	75 dc                	jne    800cb4 <strncpy+0x12>
    }
    return dst;
  800cd8:	8b 45 08             	mov    0x8(%ebp),%eax
}
  800cdb:	c9                   	leave  
  800cdc:	c3                   	ret    

00800cdd <strcmp>:
 * - A value greater than zero indicates that the first character that does
 *   not match has a greater value in @s1 than in @s2;
 * - And a value less than zero indicates the opposite.
 * */
int
strcmp(const char *s1, const char *s2) {
  800cdd:	f3 0f 1e fb          	endbr32 
  800ce1:	55                   	push   %ebp
  800ce2:	89 e5                	mov    %esp,%ebp
  800ce4:	57                   	push   %edi
  800ce5:	56                   	push   %esi
  800ce6:	83 ec 20             	sub    $0x20,%esp
  800ce9:	8b 45 08             	mov    0x8(%ebp),%eax
  800cec:	89 45 f4             	mov    %eax,-0xc(%ebp)
  800cef:	8b 45 0c             	mov    0xc(%ebp),%eax
  800cf2:	89 45 f0             	mov    %eax,-0x10(%ebp)
    asm volatile (
  800cf5:	8b 55 f4             	mov    -0xc(%ebp),%edx
  800cf8:	8b 45 f0             	mov    -0x10(%ebp),%eax
  800cfb:	89 d1                	mov    %edx,%ecx
  800cfd:	89 c2                	mov    %eax,%edx
  800cff:	89 ce                	mov    %ecx,%esi
  800d01:	89 d7                	mov    %edx,%edi
  800d03:	ac                   	lods   %ds:(%esi),%al
  800d04:	ae                   	scas   %es:(%edi),%al
  800d05:	75 08                	jne    800d0f <strcmp+0x32>
  800d07:	84 c0                	test   %al,%al
  800d09:	75 f8                	jne    800d03 <strcmp+0x26>
  800d0b:	31 c0                	xor    %eax,%eax
  800d0d:	eb 04                	jmp    800d13 <strcmp+0x36>
  800d0f:	19 c0                	sbb    %eax,%eax
  800d11:	0c 01                	or     $0x1,%al
  800d13:	89 fa                	mov    %edi,%edx
  800d15:	89 f1                	mov    %esi,%ecx
  800d17:	89 45 ec             	mov    %eax,-0x14(%ebp)
  800d1a:	89 4d e8             	mov    %ecx,-0x18(%ebp)
  800d1d:	89 55 e4             	mov    %edx,-0x1c(%ebp)
    return ret;
  800d20:	8b 45 ec             	mov    -0x14(%ebp),%eax
    while (*s1 != '\0' && *s1 == *s2) {
        s1 ++, s2 ++;
    }
    return (int)((unsigned char)*s1 - (unsigned char)*s2);
#endif /* __HAVE_ARCH_STRCMP */
}
  800d23:	83 c4 20             	add    $0x20,%esp
  800d26:	5e                   	pop    %esi
  800d27:	5f                   	pop    %edi
  800d28:	5d                   	pop    %ebp
  800d29:	c3                   	ret    

00800d2a <strncmp>:
 * they are equal to each other, it continues with the following pairs until
 * the characters differ, until a terminating null-character is reached, or
 * until @n characters match in both strings, whichever happens first.
 * */
int
strncmp(const char *s1, const char *s2, size_t n) {
  800d2a:	f3 0f 1e fb          	endbr32 
  800d2e:	55                   	push   %ebp
  800d2f:	89 e5                	mov    %esp,%ebp
    while (n > 0 && *s1 != '\0' && *s1 == *s2) {
  800d31:	eb 09                	jmp    800d3c <strncmp+0x12>
        n --, s1 ++, s2 ++;
  800d33:	ff 4d 10             	decl   0x10(%ebp)
  800d36:	ff 45 08             	incl   0x8(%ebp)
  800d39:	ff 45 0c             	incl   0xc(%ebp)
    while (n > 0 && *s1 != '\0' && *s1 == *s2) {
  800d3c:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  800d40:	74 1a                	je     800d5c <strncmp+0x32>
  800d42:	8b 45 08             	mov    0x8(%ebp),%eax
  800d45:	0f b6 00             	movzbl (%eax),%eax
  800d48:	84 c0                	test   %al,%al
  800d4a:	74 10                	je     800d5c <strncmp+0x32>
  800d4c:	8b 45 08             	mov    0x8(%ebp),%eax
  800d4f:	0f b6 10             	movzbl (%eax),%edx
  800d52:	8b 45 0c             	mov    0xc(%ebp),%eax
  800d55:	0f b6 00             	movzbl (%eax),%eax
  800d58:	38 c2                	cmp    %al,%dl
  800d5a:	74 d7                	je     800d33 <strncmp+0x9>
    }
    return (n == 0) ? 0 : (int)((unsigned char)*s1 - (unsigned char)*s2);
  800d5c:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  800d60:	74 18                	je     800d7a <strncmp+0x50>
  800d62:	8b 45 08             	mov    0x8(%ebp),%eax
  800d65:	0f b6 00             	movzbl (%eax),%eax
  800d68:	0f b6 d0             	movzbl %al,%edx
  800d6b:	8b 45 0c             	mov    0xc(%ebp),%eax
  800d6e:	0f b6 00             	movzbl (%eax),%eax
  800d71:	0f b6 c0             	movzbl %al,%eax
  800d74:	29 c2                	sub    %eax,%edx
  800d76:	89 d0                	mov    %edx,%eax
  800d78:	eb 05                	jmp    800d7f <strncmp+0x55>
  800d7a:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800d7f:	5d                   	pop    %ebp
  800d80:	c3                   	ret    

00800d81 <strchr>:
 *
 * The strchr() function returns a pointer to the first occurrence of
 * character in @s. If the value is not found, the function returns 'NULL'.
 * */
char *
strchr(const char *s, char c) {
  800d81:	f3 0f 1e fb          	endbr32 
  800d85:	55                   	push   %ebp
  800d86:	89 e5                	mov    %esp,%ebp
  800d88:	83 ec 04             	sub    $0x4,%esp
  800d8b:	8b 45 0c             	mov    0xc(%ebp),%eax
  800d8e:	88 45 fc             	mov    %al,-0x4(%ebp)
    while (*s != '\0') {
  800d91:	eb 13                	jmp    800da6 <strchr+0x25>
        if (*s == c) {
  800d93:	8b 45 08             	mov    0x8(%ebp),%eax
  800d96:	0f b6 00             	movzbl (%eax),%eax
  800d99:	38 45 fc             	cmp    %al,-0x4(%ebp)
  800d9c:	75 05                	jne    800da3 <strchr+0x22>
            return (char *)s;
  800d9e:	8b 45 08             	mov    0x8(%ebp),%eax
  800da1:	eb 12                	jmp    800db5 <strchr+0x34>
        }
        s ++;
  800da3:	ff 45 08             	incl   0x8(%ebp)
    while (*s != '\0') {
  800da6:	8b 45 08             	mov    0x8(%ebp),%eax
  800da9:	0f b6 00             	movzbl (%eax),%eax
  800dac:	84 c0                	test   %al,%al
  800dae:	75 e3                	jne    800d93 <strchr+0x12>
    }
    return NULL;
  800db0:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800db5:	c9                   	leave  
  800db6:	c3                   	ret    

00800db7 <strfind>:
 * The strfind() function is like strchr() except that if @c is
 * not found in @s, then it returns a pointer to the null byte at the
 * end of @s, rather than 'NULL'.
 * */
char *
strfind(const char *s, char c) {
  800db7:	f3 0f 1e fb          	endbr32 
  800dbb:	55                   	push   %ebp
  800dbc:	89 e5                	mov    %esp,%ebp
  800dbe:	83 ec 04             	sub    $0x4,%esp
  800dc1:	8b 45 0c             	mov    0xc(%ebp),%eax
  800dc4:	88 45 fc             	mov    %al,-0x4(%ebp)
    while (*s != '\0') {
  800dc7:	eb 0e                	jmp    800dd7 <strfind+0x20>
        if (*s == c) {
  800dc9:	8b 45 08             	mov    0x8(%ebp),%eax
  800dcc:	0f b6 00             	movzbl (%eax),%eax
  800dcf:	38 45 fc             	cmp    %al,-0x4(%ebp)
  800dd2:	74 0f                	je     800de3 <strfind+0x2c>
            break;
        }
        s ++;
  800dd4:	ff 45 08             	incl   0x8(%ebp)
    while (*s != '\0') {
  800dd7:	8b 45 08             	mov    0x8(%ebp),%eax
  800dda:	0f b6 00             	movzbl (%eax),%eax
  800ddd:	84 c0                	test   %al,%al
  800ddf:	75 e8                	jne    800dc9 <strfind+0x12>
  800de1:	eb 01                	jmp    800de4 <strfind+0x2d>
            break;
  800de3:	90                   	nop
    }
    return (char *)s;
  800de4:	8b 45 08             	mov    0x8(%ebp),%eax
}
  800de7:	c9                   	leave  
  800de8:	c3                   	ret    

00800de9 <strtol>:
 * an optional "0x" or "0X" prefix.
 *
 * The strtol() function returns the converted integral number as a long int value.
 * */
long
strtol(const char *s, char **endptr, int base) {
  800de9:	f3 0f 1e fb          	endbr32 
  800ded:	55                   	push   %ebp
  800dee:	89 e5                	mov    %esp,%ebp
  800df0:	83 ec 10             	sub    $0x10,%esp
    int neg = 0;
  800df3:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    long val = 0;
  800dfa:	c7 45 f8 00 00 00 00 	movl   $0x0,-0x8(%ebp)

    // gobble initial whitespace
    while (*s == ' ' || *s == '\t') {
  800e01:	eb 03                	jmp    800e06 <strtol+0x1d>
        s ++;
  800e03:	ff 45 08             	incl   0x8(%ebp)
    while (*s == ' ' || *s == '\t') {
  800e06:	8b 45 08             	mov    0x8(%ebp),%eax
  800e09:	0f b6 00             	movzbl (%eax),%eax
  800e0c:	3c 20                	cmp    $0x20,%al
  800e0e:	74 f3                	je     800e03 <strtol+0x1a>
  800e10:	8b 45 08             	mov    0x8(%ebp),%eax
  800e13:	0f b6 00             	movzbl (%eax),%eax
  800e16:	3c 09                	cmp    $0x9,%al
  800e18:	74 e9                	je     800e03 <strtol+0x1a>
    }

    // plus/minus sign
    if (*s == '+') {
  800e1a:	8b 45 08             	mov    0x8(%ebp),%eax
  800e1d:	0f b6 00             	movzbl (%eax),%eax
  800e20:	3c 2b                	cmp    $0x2b,%al
  800e22:	75 05                	jne    800e29 <strtol+0x40>
        s ++;
  800e24:	ff 45 08             	incl   0x8(%ebp)
  800e27:	eb 14                	jmp    800e3d <strtol+0x54>
    }
    else if (*s == '-') {
  800e29:	8b 45 08             	mov    0x8(%ebp),%eax
  800e2c:	0f b6 00             	movzbl (%eax),%eax
  800e2f:	3c 2d                	cmp    $0x2d,%al
  800e31:	75 0a                	jne    800e3d <strtol+0x54>
        s ++, neg = 1;
  800e33:	ff 45 08             	incl   0x8(%ebp)
  800e36:	c7 45 fc 01 00 00 00 	movl   $0x1,-0x4(%ebp)
    }

    // hex or octal base prefix
    if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x')) {
  800e3d:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  800e41:	74 06                	je     800e49 <strtol+0x60>
  800e43:	83 7d 10 10          	cmpl   $0x10,0x10(%ebp)
  800e47:	75 22                	jne    800e6b <strtol+0x82>
  800e49:	8b 45 08             	mov    0x8(%ebp),%eax
  800e4c:	0f b6 00             	movzbl (%eax),%eax
  800e4f:	3c 30                	cmp    $0x30,%al
  800e51:	75 18                	jne    800e6b <strtol+0x82>
  800e53:	8b 45 08             	mov    0x8(%ebp),%eax
  800e56:	40                   	inc    %eax
  800e57:	0f b6 00             	movzbl (%eax),%eax
  800e5a:	3c 78                	cmp    $0x78,%al
  800e5c:	75 0d                	jne    800e6b <strtol+0x82>
        s += 2, base = 16;
  800e5e:	83 45 08 02          	addl   $0x2,0x8(%ebp)
  800e62:	c7 45 10 10 00 00 00 	movl   $0x10,0x10(%ebp)
  800e69:	eb 29                	jmp    800e94 <strtol+0xab>
    }
    else if (base == 0 && s[0] == '0') {
  800e6b:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  800e6f:	75 16                	jne    800e87 <strtol+0x9e>
  800e71:	8b 45 08             	mov    0x8(%ebp),%eax
  800e74:	0f b6 00             	movzbl (%eax),%eax
  800e77:	3c 30                	cmp    $0x30,%al
  800e79:	75 0c                	jne    800e87 <strtol+0x9e>
        s ++, base = 8;
  800e7b:	ff 45 08             	incl   0x8(%ebp)
  800e7e:	c7 45 10 08 00 00 00 	movl   $0x8,0x10(%ebp)
  800e85:	eb 0d                	jmp    800e94 <strtol+0xab>
    }
    else if (base == 0) {
  800e87:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  800e8b:	75 07                	jne    800e94 <strtol+0xab>
        base = 10;
  800e8d:	c7 45 10 0a 00 00 00 	movl   $0xa,0x10(%ebp)

    // digits
    while (1) {
        int dig;

        if (*s >= '0' && *s <= '9') {
  800e94:	8b 45 08             	mov    0x8(%ebp),%eax
  800e97:	0f b6 00             	movzbl (%eax),%eax
  800e9a:	3c 2f                	cmp    $0x2f,%al
  800e9c:	7e 1b                	jle    800eb9 <strtol+0xd0>
  800e9e:	8b 45 08             	mov    0x8(%ebp),%eax
  800ea1:	0f b6 00             	movzbl (%eax),%eax
  800ea4:	3c 39                	cmp    $0x39,%al
  800ea6:	7f 11                	jg     800eb9 <strtol+0xd0>
            dig = *s - '0';
  800ea8:	8b 45 08             	mov    0x8(%ebp),%eax
  800eab:	0f b6 00             	movzbl (%eax),%eax
  800eae:	0f be c0             	movsbl %al,%eax
  800eb1:	83 e8 30             	sub    $0x30,%eax
  800eb4:	89 45 f4             	mov    %eax,-0xc(%ebp)
  800eb7:	eb 48                	jmp    800f01 <strtol+0x118>
        }
        else if (*s >= 'a' && *s <= 'z') {
  800eb9:	8b 45 08             	mov    0x8(%ebp),%eax
  800ebc:	0f b6 00             	movzbl (%eax),%eax
  800ebf:	3c 60                	cmp    $0x60,%al
  800ec1:	7e 1b                	jle    800ede <strtol+0xf5>
  800ec3:	8b 45 08             	mov    0x8(%ebp),%eax
  800ec6:	0f b6 00             	movzbl (%eax),%eax
  800ec9:	3c 7a                	cmp    $0x7a,%al
  800ecb:	7f 11                	jg     800ede <strtol+0xf5>
            dig = *s - 'a' + 10;
  800ecd:	8b 45 08             	mov    0x8(%ebp),%eax
  800ed0:	0f b6 00             	movzbl (%eax),%eax
  800ed3:	0f be c0             	movsbl %al,%eax
  800ed6:	83 e8 57             	sub    $0x57,%eax
  800ed9:	89 45 f4             	mov    %eax,-0xc(%ebp)
  800edc:	eb 23                	jmp    800f01 <strtol+0x118>
        }
        else if (*s >= 'A' && *s <= 'Z') {
  800ede:	8b 45 08             	mov    0x8(%ebp),%eax
  800ee1:	0f b6 00             	movzbl (%eax),%eax
  800ee4:	3c 40                	cmp    $0x40,%al
  800ee6:	7e 3b                	jle    800f23 <strtol+0x13a>
  800ee8:	8b 45 08             	mov    0x8(%ebp),%eax
  800eeb:	0f b6 00             	movzbl (%eax),%eax
  800eee:	3c 5a                	cmp    $0x5a,%al
  800ef0:	7f 31                	jg     800f23 <strtol+0x13a>
            dig = *s - 'A' + 10;
  800ef2:	8b 45 08             	mov    0x8(%ebp),%eax
  800ef5:	0f b6 00             	movzbl (%eax),%eax
  800ef8:	0f be c0             	movsbl %al,%eax
  800efb:	83 e8 37             	sub    $0x37,%eax
  800efe:	89 45 f4             	mov    %eax,-0xc(%ebp)
        }
        else {
            break;
        }
        if (dig >= base) {
  800f01:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800f04:	3b 45 10             	cmp    0x10(%ebp),%eax
  800f07:	7d 19                	jge    800f22 <strtol+0x139>
            break;
        }
        s ++, val = (val * base) + dig;
  800f09:	ff 45 08             	incl   0x8(%ebp)
  800f0c:	8b 45 f8             	mov    -0x8(%ebp),%eax
  800f0f:	0f af 45 10          	imul   0x10(%ebp),%eax
  800f13:	89 c2                	mov    %eax,%edx
  800f15:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800f18:	01 d0                	add    %edx,%eax
  800f1a:	89 45 f8             	mov    %eax,-0x8(%ebp)
    while (1) {
  800f1d:	e9 72 ff ff ff       	jmp    800e94 <strtol+0xab>
            break;
  800f22:	90                   	nop
        // we don't properly detect overflow!
    }

    if (endptr) {
  800f23:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  800f27:	74 08                	je     800f31 <strtol+0x148>
        *endptr = (char *) s;
  800f29:	8b 45 0c             	mov    0xc(%ebp),%eax
  800f2c:	8b 55 08             	mov    0x8(%ebp),%edx
  800f2f:	89 10                	mov    %edx,(%eax)
    }
    return (neg ? -val : val);
  800f31:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
  800f35:	74 07                	je     800f3e <strtol+0x155>
  800f37:	8b 45 f8             	mov    -0x8(%ebp),%eax
  800f3a:	f7 d8                	neg    %eax
  800f3c:	eb 03                	jmp    800f41 <strtol+0x158>
  800f3e:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
  800f41:	c9                   	leave  
  800f42:	c3                   	ret    

00800f43 <memset>:
 * @n:      number of bytes to be set to the value
 *
 * The memset() function returns @s.
 * */
void *
memset(void *s, char c, size_t n) {
  800f43:	f3 0f 1e fb          	endbr32 
  800f47:	55                   	push   %ebp
  800f48:	89 e5                	mov    %esp,%ebp
  800f4a:	57                   	push   %edi
  800f4b:	83 ec 24             	sub    $0x24,%esp
  800f4e:	8b 45 0c             	mov    0xc(%ebp),%eax
  800f51:	88 45 d8             	mov    %al,-0x28(%ebp)
#ifdef __HAVE_ARCH_MEMSET
    return __memset(s, c, n);
  800f54:	0f be 55 d8          	movsbl -0x28(%ebp),%edx
  800f58:	8b 45 08             	mov    0x8(%ebp),%eax
  800f5b:	89 45 f8             	mov    %eax,-0x8(%ebp)
  800f5e:	88 55 f7             	mov    %dl,-0x9(%ebp)
  800f61:	8b 45 10             	mov    0x10(%ebp),%eax
  800f64:	89 45 f0             	mov    %eax,-0x10(%ebp)
#ifndef __HAVE_ARCH_MEMSET
#define __HAVE_ARCH_MEMSET
static inline void *
__memset(void *s, char c, size_t n) {
    int d0, d1;
    asm volatile (
  800f67:	8b 4d f0             	mov    -0x10(%ebp),%ecx
  800f6a:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
  800f6e:	8b 55 f8             	mov    -0x8(%ebp),%edx
  800f71:	89 d7                	mov    %edx,%edi
  800f73:	f3 aa                	rep stos %al,%es:(%edi)
  800f75:	89 fa                	mov    %edi,%edx
  800f77:	89 4d ec             	mov    %ecx,-0x14(%ebp)
  800f7a:	89 55 e8             	mov    %edx,-0x18(%ebp)
        "rep; stosb;"
        : "=&c" (d0), "=&D" (d1)
        : "0" (n), "a" (c), "1" (s)
        : "memory");
    return s;
  800f7d:	8b 45 f8             	mov    -0x8(%ebp),%eax
    while (n -- > 0) {
        *p ++ = c;
    }
    return s;
#endif /* __HAVE_ARCH_MEMSET */
}
  800f80:	83 c4 24             	add    $0x24,%esp
  800f83:	5f                   	pop    %edi
  800f84:	5d                   	pop    %ebp
  800f85:	c3                   	ret    

00800f86 <memmove>:
 * @n:      number of bytes to copy
 *
 * The memmove() function returns @dst.
 * */
void *
memmove(void *dst, const void *src, size_t n) {
  800f86:	f3 0f 1e fb          	endbr32 
  800f8a:	55                   	push   %ebp
  800f8b:	89 e5                	mov    %esp,%ebp
  800f8d:	57                   	push   %edi
  800f8e:	56                   	push   %esi
  800f8f:	53                   	push   %ebx
  800f90:	83 ec 30             	sub    $0x30,%esp
  800f93:	8b 45 08             	mov    0x8(%ebp),%eax
  800f96:	89 45 f0             	mov    %eax,-0x10(%ebp)
  800f99:	8b 45 0c             	mov    0xc(%ebp),%eax
  800f9c:	89 45 ec             	mov    %eax,-0x14(%ebp)
  800f9f:	8b 45 10             	mov    0x10(%ebp),%eax
  800fa2:	89 45 e8             	mov    %eax,-0x18(%ebp)

#ifndef __HAVE_ARCH_MEMMOVE
#define __HAVE_ARCH_MEMMOVE
static inline void *
__memmove(void *dst, const void *src, size_t n) {
    if (dst < src) {
  800fa5:	8b 45 f0             	mov    -0x10(%ebp),%eax
  800fa8:	3b 45 ec             	cmp    -0x14(%ebp),%eax
  800fab:	73 42                	jae    800fef <memmove+0x69>
  800fad:	8b 45 f0             	mov    -0x10(%ebp),%eax
  800fb0:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800fb3:	8b 45 ec             	mov    -0x14(%ebp),%eax
  800fb6:	89 45 e0             	mov    %eax,-0x20(%ebp)
  800fb9:	8b 45 e8             	mov    -0x18(%ebp),%eax
  800fbc:	89 45 dc             	mov    %eax,-0x24(%ebp)
        "andl $3, %%ecx;"
        "jz 1f;"
        "rep; movsb;"
        "1:"
        : "=&c" (d0), "=&D" (d1), "=&S" (d2)
        : "0" (n / 4), "g" (n), "1" (dst), "2" (src)
  800fbf:	8b 45 dc             	mov    -0x24(%ebp),%eax
  800fc2:	c1 e8 02             	shr    $0x2,%eax
  800fc5:	89 c1                	mov    %eax,%ecx
    asm volatile (
  800fc7:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  800fca:	8b 45 e0             	mov    -0x20(%ebp),%eax
  800fcd:	89 d7                	mov    %edx,%edi
  800fcf:	89 c6                	mov    %eax,%esi
  800fd1:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800fd3:	8b 4d dc             	mov    -0x24(%ebp),%ecx
  800fd6:	83 e1 03             	and    $0x3,%ecx
  800fd9:	74 02                	je     800fdd <memmove+0x57>
  800fdb:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
  800fdd:	89 f0                	mov    %esi,%eax
  800fdf:	89 fa                	mov    %edi,%edx
  800fe1:	89 4d d8             	mov    %ecx,-0x28(%ebp)
  800fe4:	89 55 d4             	mov    %edx,-0x2c(%ebp)
  800fe7:	89 45 d0             	mov    %eax,-0x30(%ebp)
        : "memory");
    return dst;
  800fea:	8b 45 e4             	mov    -0x1c(%ebp),%eax
        return __memcpy(dst, src, n);
  800fed:	eb 36                	jmp    801025 <memmove+0x9f>
        : "0" (n), "1" (n - 1 + src), "2" (n - 1 + dst)
  800fef:	8b 45 e8             	mov    -0x18(%ebp),%eax
  800ff2:	8d 50 ff             	lea    -0x1(%eax),%edx
  800ff5:	8b 45 ec             	mov    -0x14(%ebp),%eax
  800ff8:	01 c2                	add    %eax,%edx
  800ffa:	8b 45 e8             	mov    -0x18(%ebp),%eax
  800ffd:	8d 48 ff             	lea    -0x1(%eax),%ecx
  801000:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801003:	8d 1c 01             	lea    (%ecx,%eax,1),%ebx
    asm volatile (
  801006:	8b 45 e8             	mov    -0x18(%ebp),%eax
  801009:	89 c1                	mov    %eax,%ecx
  80100b:	89 d8                	mov    %ebx,%eax
  80100d:	89 d6                	mov    %edx,%esi
  80100f:	89 c7                	mov    %eax,%edi
  801011:	fd                   	std    
  801012:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
  801014:	fc                   	cld    
  801015:	89 f8                	mov    %edi,%eax
  801017:	89 f2                	mov    %esi,%edx
  801019:	89 4d cc             	mov    %ecx,-0x34(%ebp)
  80101c:	89 55 c8             	mov    %edx,-0x38(%ebp)
  80101f:	89 45 c4             	mov    %eax,-0x3c(%ebp)
    return dst;
  801022:	8b 45 f0             	mov    -0x10(%ebp),%eax
            *d ++ = *s ++;
        }
    }
    return dst;
#endif /* __HAVE_ARCH_MEMMOVE */
}
  801025:	83 c4 30             	add    $0x30,%esp
  801028:	5b                   	pop    %ebx
  801029:	5e                   	pop    %esi
  80102a:	5f                   	pop    %edi
  80102b:	5d                   	pop    %ebp
  80102c:	c3                   	ret    

0080102d <memcpy>:
 * it always copies exactly @n bytes. To avoid overflows, the size of arrays pointed
 * by both @src and @dst, should be at least @n bytes, and should not overlap
 * (for overlapping memory area, memmove is a safer approach).
 * */
void *
memcpy(void *dst, const void *src, size_t n) {
  80102d:	f3 0f 1e fb          	endbr32 
  801031:	55                   	push   %ebp
  801032:	89 e5                	mov    %esp,%ebp
  801034:	57                   	push   %edi
  801035:	56                   	push   %esi
  801036:	83 ec 20             	sub    $0x20,%esp
  801039:	8b 45 08             	mov    0x8(%ebp),%eax
  80103c:	89 45 f4             	mov    %eax,-0xc(%ebp)
  80103f:	8b 45 0c             	mov    0xc(%ebp),%eax
  801042:	89 45 f0             	mov    %eax,-0x10(%ebp)
  801045:	8b 45 10             	mov    0x10(%ebp),%eax
  801048:	89 45 ec             	mov    %eax,-0x14(%ebp)
        : "0" (n / 4), "g" (n), "1" (dst), "2" (src)
  80104b:	8b 45 ec             	mov    -0x14(%ebp),%eax
  80104e:	c1 e8 02             	shr    $0x2,%eax
  801051:	89 c1                	mov    %eax,%ecx
    asm volatile (
  801053:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801056:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801059:	89 d7                	mov    %edx,%edi
  80105b:	89 c6                	mov    %eax,%esi
  80105d:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  80105f:	8b 4d ec             	mov    -0x14(%ebp),%ecx
  801062:	83 e1 03             	and    $0x3,%ecx
  801065:	74 02                	je     801069 <memcpy+0x3c>
  801067:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
  801069:	89 f0                	mov    %esi,%eax
  80106b:	89 fa                	mov    %edi,%edx
  80106d:	89 4d e8             	mov    %ecx,-0x18(%ebp)
  801070:	89 55 e4             	mov    %edx,-0x1c(%ebp)
  801073:	89 45 e0             	mov    %eax,-0x20(%ebp)
    return dst;
  801076:	8b 45 f4             	mov    -0xc(%ebp),%eax
    while (n -- > 0) {
        *d ++ = *s ++;
    }
    return dst;
#endif /* __HAVE_ARCH_MEMCPY */
}
  801079:	83 c4 20             	add    $0x20,%esp
  80107c:	5e                   	pop    %esi
  80107d:	5f                   	pop    %edi
  80107e:	5d                   	pop    %ebp
  80107f:	c3                   	ret    

00801080 <memcmp>:
 *   match in both memory blocks has a greater value in @v1 than in @v2
 *   as if evaluated as unsigned char values;
 * - And a value less than zero indicates the opposite.
 * */
int
memcmp(const void *v1, const void *v2, size_t n) {
  801080:	f3 0f 1e fb          	endbr32 
  801084:	55                   	push   %ebp
  801085:	89 e5                	mov    %esp,%ebp
  801087:	83 ec 10             	sub    $0x10,%esp
    const char *s1 = (const char *)v1;
  80108a:	8b 45 08             	mov    0x8(%ebp),%eax
  80108d:	89 45 fc             	mov    %eax,-0x4(%ebp)
    const char *s2 = (const char *)v2;
  801090:	8b 45 0c             	mov    0xc(%ebp),%eax
  801093:	89 45 f8             	mov    %eax,-0x8(%ebp)
    while (n -- > 0) {
  801096:	eb 2e                	jmp    8010c6 <memcmp+0x46>
        if (*s1 != *s2) {
  801098:	8b 45 fc             	mov    -0x4(%ebp),%eax
  80109b:	0f b6 10             	movzbl (%eax),%edx
  80109e:	8b 45 f8             	mov    -0x8(%ebp),%eax
  8010a1:	0f b6 00             	movzbl (%eax),%eax
  8010a4:	38 c2                	cmp    %al,%dl
  8010a6:	74 18                	je     8010c0 <memcmp+0x40>
            return (int)((unsigned char)*s1 - (unsigned char)*s2);
  8010a8:	8b 45 fc             	mov    -0x4(%ebp),%eax
  8010ab:	0f b6 00             	movzbl (%eax),%eax
  8010ae:	0f b6 d0             	movzbl %al,%edx
  8010b1:	8b 45 f8             	mov    -0x8(%ebp),%eax
  8010b4:	0f b6 00             	movzbl (%eax),%eax
  8010b7:	0f b6 c0             	movzbl %al,%eax
  8010ba:	29 c2                	sub    %eax,%edx
  8010bc:	89 d0                	mov    %edx,%eax
  8010be:	eb 18                	jmp    8010d8 <memcmp+0x58>
        }
        s1 ++, s2 ++;
  8010c0:	ff 45 fc             	incl   -0x4(%ebp)
  8010c3:	ff 45 f8             	incl   -0x8(%ebp)
    while (n -- > 0) {
  8010c6:	8b 45 10             	mov    0x10(%ebp),%eax
  8010c9:	8d 50 ff             	lea    -0x1(%eax),%edx
  8010cc:	89 55 10             	mov    %edx,0x10(%ebp)
  8010cf:	85 c0                	test   %eax,%eax
  8010d1:	75 c5                	jne    801098 <memcmp+0x18>
    }
    return 0;
  8010d3:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8010d8:	c9                   	leave  
  8010d9:	c3                   	ret    

008010da <printnum>:
 * @width:      maximum number of digits, if the actual width is less than @width, use @padc instead
 * @padc:       character that padded on the left if the actual width is less than @width
 * */
static void
printnum(void (*putch)(int, void*, int), int fd, void *putdat,
        unsigned long long num, unsigned base, int width, int padc) {
  8010da:	f3 0f 1e fb          	endbr32 
  8010de:	55                   	push   %ebp
  8010df:	89 e5                	mov    %esp,%ebp
  8010e1:	83 ec 58             	sub    $0x58,%esp
  8010e4:	8b 45 14             	mov    0x14(%ebp),%eax
  8010e7:	89 45 d0             	mov    %eax,-0x30(%ebp)
  8010ea:	8b 45 18             	mov    0x18(%ebp),%eax
  8010ed:	89 45 d4             	mov    %eax,-0x2c(%ebp)
    unsigned long long result = num;
  8010f0:	8b 45 d0             	mov    -0x30(%ebp),%eax
  8010f3:	8b 55 d4             	mov    -0x2c(%ebp),%edx
  8010f6:	89 45 e8             	mov    %eax,-0x18(%ebp)
  8010f9:	89 55 ec             	mov    %edx,-0x14(%ebp)
    unsigned mod = do_div(result, base);
  8010fc:	8b 45 1c             	mov    0x1c(%ebp),%eax
  8010ff:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  801102:	8b 45 e8             	mov    -0x18(%ebp),%eax
  801105:	8b 55 ec             	mov    -0x14(%ebp),%edx
  801108:	89 45 e0             	mov    %eax,-0x20(%ebp)
  80110b:	89 55 f0             	mov    %edx,-0x10(%ebp)
  80110e:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801111:	89 45 f4             	mov    %eax,-0xc(%ebp)
  801114:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
  801118:	74 1c                	je     801136 <printnum+0x5c>
  80111a:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80111d:	ba 00 00 00 00       	mov    $0x0,%edx
  801122:	f7 75 e4             	divl   -0x1c(%ebp)
  801125:	89 55 f4             	mov    %edx,-0xc(%ebp)
  801128:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80112b:	ba 00 00 00 00       	mov    $0x0,%edx
  801130:	f7 75 e4             	divl   -0x1c(%ebp)
  801133:	89 45 f0             	mov    %eax,-0x10(%ebp)
  801136:	8b 45 e0             	mov    -0x20(%ebp),%eax
  801139:	8b 55 f4             	mov    -0xc(%ebp),%edx
  80113c:	f7 75 e4             	divl   -0x1c(%ebp)
  80113f:	89 45 e0             	mov    %eax,-0x20(%ebp)
  801142:	89 55 dc             	mov    %edx,-0x24(%ebp)
  801145:	8b 45 e0             	mov    -0x20(%ebp),%eax
  801148:	8b 55 f0             	mov    -0x10(%ebp),%edx
  80114b:	89 45 e8             	mov    %eax,-0x18(%ebp)
  80114e:	89 55 ec             	mov    %edx,-0x14(%ebp)
  801151:	8b 45 dc             	mov    -0x24(%ebp),%eax
  801154:	89 45 d8             	mov    %eax,-0x28(%ebp)

    // first recursively print all preceding (more significant) digits
    if (num >= base) {
  801157:	8b 45 1c             	mov    0x1c(%ebp),%eax
  80115a:	ba 00 00 00 00       	mov    $0x0,%edx
  80115f:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
  801162:	39 45 d0             	cmp    %eax,-0x30(%ebp)
  801165:	19 d1                	sbb    %edx,%ecx
  801167:	72 5a                	jb     8011c3 <printnum+0xe9>
        printnum(putch, fd, putdat, result, base, width - 1, padc);
  801169:	8b 45 20             	mov    0x20(%ebp),%eax
  80116c:	8d 50 ff             	lea    -0x1(%eax),%edx
  80116f:	8b 45 24             	mov    0x24(%ebp),%eax
  801172:	89 44 24 1c          	mov    %eax,0x1c(%esp)
  801176:	89 54 24 18          	mov    %edx,0x18(%esp)
  80117a:	8b 45 1c             	mov    0x1c(%ebp),%eax
  80117d:	89 44 24 14          	mov    %eax,0x14(%esp)
  801181:	8b 45 e8             	mov    -0x18(%ebp),%eax
  801184:	8b 55 ec             	mov    -0x14(%ebp),%edx
  801187:	89 44 24 0c          	mov    %eax,0xc(%esp)
  80118b:	89 54 24 10          	mov    %edx,0x10(%esp)
  80118f:	8b 45 10             	mov    0x10(%ebp),%eax
  801192:	89 44 24 08          	mov    %eax,0x8(%esp)
  801196:	8b 45 0c             	mov    0xc(%ebp),%eax
  801199:	89 44 24 04          	mov    %eax,0x4(%esp)
  80119d:	8b 45 08             	mov    0x8(%ebp),%eax
  8011a0:	89 04 24             	mov    %eax,(%esp)
  8011a3:	e8 32 ff ff ff       	call   8010da <printnum>
  8011a8:	eb 22                	jmp    8011cc <printnum+0xf2>
    } else {
        // print any needed pad characters before first digit
        while (-- width > 0)
            putch(padc, putdat, fd);
  8011aa:	8b 45 0c             	mov    0xc(%ebp),%eax
  8011ad:	89 44 24 08          	mov    %eax,0x8(%esp)
  8011b1:	8b 45 10             	mov    0x10(%ebp),%eax
  8011b4:	89 44 24 04          	mov    %eax,0x4(%esp)
  8011b8:	8b 45 24             	mov    0x24(%ebp),%eax
  8011bb:	89 04 24             	mov    %eax,(%esp)
  8011be:	8b 45 08             	mov    0x8(%ebp),%eax
  8011c1:	ff d0                	call   *%eax
        while (-- width > 0)
  8011c3:	ff 4d 20             	decl   0x20(%ebp)
  8011c6:	83 7d 20 00          	cmpl   $0x0,0x20(%ebp)
  8011ca:	7f de                	jg     8011aa <printnum+0xd0>
    }
    // then print this (the least significant) digit
    putch("0123456789abcdef"[mod], putdat, fd);
  8011cc:	8b 45 d8             	mov    -0x28(%ebp),%eax
  8011cf:	05 84 1d 80 00       	add    $0x801d84,%eax
  8011d4:	0f b6 00             	movzbl (%eax),%eax
  8011d7:	0f be c0             	movsbl %al,%eax
  8011da:	8b 55 0c             	mov    0xc(%ebp),%edx
  8011dd:	89 54 24 08          	mov    %edx,0x8(%esp)
  8011e1:	8b 55 10             	mov    0x10(%ebp),%edx
  8011e4:	89 54 24 04          	mov    %edx,0x4(%esp)
  8011e8:	89 04 24             	mov    %eax,(%esp)
  8011eb:	8b 45 08             	mov    0x8(%ebp),%eax
  8011ee:	ff d0                	call   *%eax
}
  8011f0:	90                   	nop
  8011f1:	c9                   	leave  
  8011f2:	c3                   	ret    

008011f3 <getuint>:
 * getuint - get an unsigned int of various possible sizes from a varargs list
 * @ap:         a varargs list pointer
 * @lflag:      determines the size of the vararg that @ap points to
 * */
static unsigned long long
getuint(va_list *ap, int lflag) {
  8011f3:	f3 0f 1e fb          	endbr32 
  8011f7:	55                   	push   %ebp
  8011f8:	89 e5                	mov    %esp,%ebp
    if (lflag >= 2) {
  8011fa:	83 7d 0c 01          	cmpl   $0x1,0xc(%ebp)
  8011fe:	7e 14                	jle    801214 <getuint+0x21>
        return va_arg(*ap, unsigned long long);
  801200:	8b 45 08             	mov    0x8(%ebp),%eax
  801203:	8b 00                	mov    (%eax),%eax
  801205:	8d 48 08             	lea    0x8(%eax),%ecx
  801208:	8b 55 08             	mov    0x8(%ebp),%edx
  80120b:	89 0a                	mov    %ecx,(%edx)
  80120d:	8b 50 04             	mov    0x4(%eax),%edx
  801210:	8b 00                	mov    (%eax),%eax
  801212:	eb 30                	jmp    801244 <getuint+0x51>
    }
    else if (lflag) {
  801214:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  801218:	74 16                	je     801230 <getuint+0x3d>
        return va_arg(*ap, unsigned long);
  80121a:	8b 45 08             	mov    0x8(%ebp),%eax
  80121d:	8b 00                	mov    (%eax),%eax
  80121f:	8d 48 04             	lea    0x4(%eax),%ecx
  801222:	8b 55 08             	mov    0x8(%ebp),%edx
  801225:	89 0a                	mov    %ecx,(%edx)
  801227:	8b 00                	mov    (%eax),%eax
  801229:	ba 00 00 00 00       	mov    $0x0,%edx
  80122e:	eb 14                	jmp    801244 <getuint+0x51>
    }
    else {
        return va_arg(*ap, unsigned int);
  801230:	8b 45 08             	mov    0x8(%ebp),%eax
  801233:	8b 00                	mov    (%eax),%eax
  801235:	8d 48 04             	lea    0x4(%eax),%ecx
  801238:	8b 55 08             	mov    0x8(%ebp),%edx
  80123b:	89 0a                	mov    %ecx,(%edx)
  80123d:	8b 00                	mov    (%eax),%eax
  80123f:	ba 00 00 00 00       	mov    $0x0,%edx
    }
}
  801244:	5d                   	pop    %ebp
  801245:	c3                   	ret    

00801246 <getint>:
 * getint - same as getuint but signed, we can't use getuint because of sign extension
 * @ap:         a varargs list pointer
 * @lflag:      determines the size of the vararg that @ap points to
 * */
static long long
getint(va_list *ap, int lflag) {
  801246:	f3 0f 1e fb          	endbr32 
  80124a:	55                   	push   %ebp
  80124b:	89 e5                	mov    %esp,%ebp
    if (lflag >= 2) {
  80124d:	83 7d 0c 01          	cmpl   $0x1,0xc(%ebp)
  801251:	7e 14                	jle    801267 <getint+0x21>
        return va_arg(*ap, long long);
  801253:	8b 45 08             	mov    0x8(%ebp),%eax
  801256:	8b 00                	mov    (%eax),%eax
  801258:	8d 48 08             	lea    0x8(%eax),%ecx
  80125b:	8b 55 08             	mov    0x8(%ebp),%edx
  80125e:	89 0a                	mov    %ecx,(%edx)
  801260:	8b 50 04             	mov    0x4(%eax),%edx
  801263:	8b 00                	mov    (%eax),%eax
  801265:	eb 28                	jmp    80128f <getint+0x49>
    }
    else if (lflag) {
  801267:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  80126b:	74 12                	je     80127f <getint+0x39>
        return va_arg(*ap, long);
  80126d:	8b 45 08             	mov    0x8(%ebp),%eax
  801270:	8b 00                	mov    (%eax),%eax
  801272:	8d 48 04             	lea    0x4(%eax),%ecx
  801275:	8b 55 08             	mov    0x8(%ebp),%edx
  801278:	89 0a                	mov    %ecx,(%edx)
  80127a:	8b 00                	mov    (%eax),%eax
  80127c:	99                   	cltd   
  80127d:	eb 10                	jmp    80128f <getint+0x49>
    }
    else {
        return va_arg(*ap, int);
  80127f:	8b 45 08             	mov    0x8(%ebp),%eax
  801282:	8b 00                	mov    (%eax),%eax
  801284:	8d 48 04             	lea    0x4(%eax),%ecx
  801287:	8b 55 08             	mov    0x8(%ebp),%edx
  80128a:	89 0a                	mov    %ecx,(%edx)
  80128c:	8b 00                	mov    (%eax),%eax
  80128e:	99                   	cltd   
    }
}
  80128f:	5d                   	pop    %ebp
  801290:	c3                   	ret    

00801291 <printfmt>:
 * @fd:         file descriptor
 * @putdat:     used by @putch function
 * @fmt:        the format string to use
 * */
void
printfmt(void (*putch)(int, void*, int), int fd, void *putdat, const char *fmt, ...) {
  801291:	f3 0f 1e fb          	endbr32 
  801295:	55                   	push   %ebp
  801296:	89 e5                	mov    %esp,%ebp
  801298:	83 ec 38             	sub    $0x38,%esp
    va_list ap;

    va_start(ap, fmt);
  80129b:	8d 45 18             	lea    0x18(%ebp),%eax
  80129e:	89 45 f4             	mov    %eax,-0xc(%ebp)
    vprintfmt(putch, fd, putdat, fmt, ap);
  8012a1:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8012a4:	89 44 24 10          	mov    %eax,0x10(%esp)
  8012a8:	8b 45 14             	mov    0x14(%ebp),%eax
  8012ab:	89 44 24 0c          	mov    %eax,0xc(%esp)
  8012af:	8b 45 10             	mov    0x10(%ebp),%eax
  8012b2:	89 44 24 08          	mov    %eax,0x8(%esp)
  8012b6:	8b 45 0c             	mov    0xc(%ebp),%eax
  8012b9:	89 44 24 04          	mov    %eax,0x4(%esp)
  8012bd:	8b 45 08             	mov    0x8(%ebp),%eax
  8012c0:	89 04 24             	mov    %eax,(%esp)
  8012c3:	e8 03 00 00 00       	call   8012cb <vprintfmt>
    va_end(ap);
}
  8012c8:	90                   	nop
  8012c9:	c9                   	leave  
  8012ca:	c3                   	ret    

008012cb <vprintfmt>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want printfmt() instead.
 * */
void
vprintfmt(void (*putch)(int, void*, int), int fd, void *putdat, const char *fmt, va_list ap) {
  8012cb:	f3 0f 1e fb          	endbr32 
  8012cf:	55                   	push   %ebp
  8012d0:	89 e5                	mov    %esp,%ebp
  8012d2:	56                   	push   %esi
  8012d3:	53                   	push   %ebx
  8012d4:	83 ec 40             	sub    $0x40,%esp
    register int ch, err;
    unsigned long long num;
    int base, width, precision, lflag, altflag;

    while (1) {
        while ((ch = *(unsigned char *)fmt ++) != '%') {
  8012d7:	eb 1e                	jmp    8012f7 <vprintfmt+0x2c>
            if (ch == '\0') {
  8012d9:	85 db                	test   %ebx,%ebx
  8012db:	0f 84 2a 04 00 00    	je     80170b <vprintfmt+0x440>
                return;
            }
            putch(ch, putdat, fd);
  8012e1:	8b 45 0c             	mov    0xc(%ebp),%eax
  8012e4:	89 44 24 08          	mov    %eax,0x8(%esp)
  8012e8:	8b 45 10             	mov    0x10(%ebp),%eax
  8012eb:	89 44 24 04          	mov    %eax,0x4(%esp)
  8012ef:	89 1c 24             	mov    %ebx,(%esp)
  8012f2:	8b 45 08             	mov    0x8(%ebp),%eax
  8012f5:	ff d0                	call   *%eax
        while ((ch = *(unsigned char *)fmt ++) != '%') {
  8012f7:	8b 45 14             	mov    0x14(%ebp),%eax
  8012fa:	8d 50 01             	lea    0x1(%eax),%edx
  8012fd:	89 55 14             	mov    %edx,0x14(%ebp)
  801300:	0f b6 00             	movzbl (%eax),%eax
  801303:	0f b6 d8             	movzbl %al,%ebx
  801306:	83 fb 25             	cmp    $0x25,%ebx
  801309:	75 ce                	jne    8012d9 <vprintfmt+0xe>
        }

        // Process a %-escape sequence
        char padc = ' ';
  80130b:	c6 45 db 20          	movb   $0x20,-0x25(%ebp)
        width = precision = -1;
  80130f:	c7 45 e4 ff ff ff ff 	movl   $0xffffffff,-0x1c(%ebp)
  801316:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  801319:	89 45 e8             	mov    %eax,-0x18(%ebp)
        lflag = altflag = 0;
  80131c:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
  801323:	8b 45 dc             	mov    -0x24(%ebp),%eax
  801326:	89 45 e0             	mov    %eax,-0x20(%ebp)

    reswitch:
        switch (ch = *(unsigned char *)fmt ++) {
  801329:	8b 45 14             	mov    0x14(%ebp),%eax
  80132c:	8d 50 01             	lea    0x1(%eax),%edx
  80132f:	89 55 14             	mov    %edx,0x14(%ebp)
  801332:	0f b6 00             	movzbl (%eax),%eax
  801335:	0f b6 d8             	movzbl %al,%ebx
  801338:	8d 43 dd             	lea    -0x23(%ebx),%eax
  80133b:	83 f8 55             	cmp    $0x55,%eax
  80133e:	0f 87 94 03 00 00    	ja     8016d8 <vprintfmt+0x40d>
  801344:	8b 04 85 a8 1d 80 00 	mov    0x801da8(,%eax,4),%eax
  80134b:	3e ff e0             	notrack jmp *%eax

        // flag to pad on the right
        case '-':
            padc = '-';
  80134e:	c6 45 db 2d          	movb   $0x2d,-0x25(%ebp)
            goto reswitch;
  801352:	eb d5                	jmp    801329 <vprintfmt+0x5e>

        // flag to pad with 0's instead of spaces
        case '0':
            padc = '0';
  801354:	c6 45 db 30          	movb   $0x30,-0x25(%ebp)
            goto reswitch;
  801358:	eb cf                	jmp    801329 <vprintfmt+0x5e>

        // width field
        case '1' ... '9':
            for (precision = 0; ; ++ fmt) {
  80135a:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
                precision = precision * 10 + ch - '0';
  801361:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  801364:	89 d0                	mov    %edx,%eax
  801366:	c1 e0 02             	shl    $0x2,%eax
  801369:	01 d0                	add    %edx,%eax
  80136b:	01 c0                	add    %eax,%eax
  80136d:	01 d8                	add    %ebx,%eax
  80136f:	83 e8 30             	sub    $0x30,%eax
  801372:	89 45 e4             	mov    %eax,-0x1c(%ebp)
                ch = *fmt;
  801375:	8b 45 14             	mov    0x14(%ebp),%eax
  801378:	0f b6 00             	movzbl (%eax),%eax
  80137b:	0f be d8             	movsbl %al,%ebx
                if (ch < '0' || ch > '9') {
  80137e:	83 fb 2f             	cmp    $0x2f,%ebx
  801381:	7e 38                	jle    8013bb <vprintfmt+0xf0>
  801383:	83 fb 39             	cmp    $0x39,%ebx
  801386:	7f 33                	jg     8013bb <vprintfmt+0xf0>
            for (precision = 0; ; ++ fmt) {
  801388:	ff 45 14             	incl   0x14(%ebp)
                precision = precision * 10 + ch - '0';
  80138b:	eb d4                	jmp    801361 <vprintfmt+0x96>
                }
            }
            goto process_precision;

        case '*':
            precision = va_arg(ap, int);
  80138d:	8b 45 18             	mov    0x18(%ebp),%eax
  801390:	8d 50 04             	lea    0x4(%eax),%edx
  801393:	89 55 18             	mov    %edx,0x18(%ebp)
  801396:	8b 00                	mov    (%eax),%eax
  801398:	89 45 e4             	mov    %eax,-0x1c(%ebp)
            goto process_precision;
  80139b:	eb 1f                	jmp    8013bc <vprintfmt+0xf1>

        case '.':
            if (width < 0)
  80139d:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
  8013a1:	79 86                	jns    801329 <vprintfmt+0x5e>
                width = 0;
  8013a3:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
            goto reswitch;
  8013aa:	e9 7a ff ff ff       	jmp    801329 <vprintfmt+0x5e>

        case '#':
            altflag = 1;
  8013af:	c7 45 dc 01 00 00 00 	movl   $0x1,-0x24(%ebp)
            goto reswitch;
  8013b6:	e9 6e ff ff ff       	jmp    801329 <vprintfmt+0x5e>
            goto process_precision;
  8013bb:	90                   	nop

        process_precision:
            if (width < 0)
  8013bc:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
  8013c0:	0f 89 63 ff ff ff    	jns    801329 <vprintfmt+0x5e>
                width = precision, precision = -1;
  8013c6:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  8013c9:	89 45 e8             	mov    %eax,-0x18(%ebp)
  8013cc:	c7 45 e4 ff ff ff ff 	movl   $0xffffffff,-0x1c(%ebp)
            goto reswitch;
  8013d3:	e9 51 ff ff ff       	jmp    801329 <vprintfmt+0x5e>

        // long flag (doubled for long long)
        case 'l':
            lflag ++;
  8013d8:	ff 45 e0             	incl   -0x20(%ebp)
            goto reswitch;
  8013db:	e9 49 ff ff ff       	jmp    801329 <vprintfmt+0x5e>

        // character
        case 'c':
            putch(va_arg(ap, int), putdat, fd);
  8013e0:	8b 45 18             	mov    0x18(%ebp),%eax
  8013e3:	8d 50 04             	lea    0x4(%eax),%edx
  8013e6:	89 55 18             	mov    %edx,0x18(%ebp)
  8013e9:	8b 00                	mov    (%eax),%eax
  8013eb:	8b 55 0c             	mov    0xc(%ebp),%edx
  8013ee:	89 54 24 08          	mov    %edx,0x8(%esp)
  8013f2:	8b 55 10             	mov    0x10(%ebp),%edx
  8013f5:	89 54 24 04          	mov    %edx,0x4(%esp)
  8013f9:	89 04 24             	mov    %eax,(%esp)
  8013fc:	8b 45 08             	mov    0x8(%ebp),%eax
  8013ff:	ff d0                	call   *%eax
            break;
  801401:	e9 00 03 00 00       	jmp    801706 <vprintfmt+0x43b>

        // error message
        case 'e':
            err = va_arg(ap, int);
  801406:	8b 45 18             	mov    0x18(%ebp),%eax
  801409:	8d 50 04             	lea    0x4(%eax),%edx
  80140c:	89 55 18             	mov    %edx,0x18(%ebp)
  80140f:	8b 18                	mov    (%eax),%ebx
            if (err < 0) {
  801411:	85 db                	test   %ebx,%ebx
  801413:	79 02                	jns    801417 <vprintfmt+0x14c>
                err = -err;
  801415:	f7 db                	neg    %ebx
            }
            if (err > MAXERROR || (p = error_string[err]) == NULL) {
  801417:	83 fb 18             	cmp    $0x18,%ebx
  80141a:	7f 0b                	jg     801427 <vprintfmt+0x15c>
  80141c:	8b 34 9d 20 1d 80 00 	mov    0x801d20(,%ebx,4),%esi
  801423:	85 f6                	test   %esi,%esi
  801425:	75 2a                	jne    801451 <vprintfmt+0x186>
                printfmt(putch, fd, putdat, "error %d", err);
  801427:	89 5c 24 10          	mov    %ebx,0x10(%esp)
  80142b:	c7 44 24 0c 95 1d 80 	movl   $0x801d95,0xc(%esp)
  801432:	00 
  801433:	8b 45 10             	mov    0x10(%ebp),%eax
  801436:	89 44 24 08          	mov    %eax,0x8(%esp)
  80143a:	8b 45 0c             	mov    0xc(%ebp),%eax
  80143d:	89 44 24 04          	mov    %eax,0x4(%esp)
  801441:	8b 45 08             	mov    0x8(%ebp),%eax
  801444:	89 04 24             	mov    %eax,(%esp)
  801447:	e8 45 fe ff ff       	call   801291 <printfmt>
            }
            else {
                printfmt(putch, fd, putdat, "%s", p);
            }
            break;
  80144c:	e9 b5 02 00 00       	jmp    801706 <vprintfmt+0x43b>
                printfmt(putch, fd, putdat, "%s", p);
  801451:	89 74 24 10          	mov    %esi,0x10(%esp)
  801455:	c7 44 24 0c 9e 1d 80 	movl   $0x801d9e,0xc(%esp)
  80145c:	00 
  80145d:	8b 45 10             	mov    0x10(%ebp),%eax
  801460:	89 44 24 08          	mov    %eax,0x8(%esp)
  801464:	8b 45 0c             	mov    0xc(%ebp),%eax
  801467:	89 44 24 04          	mov    %eax,0x4(%esp)
  80146b:	8b 45 08             	mov    0x8(%ebp),%eax
  80146e:	89 04 24             	mov    %eax,(%esp)
  801471:	e8 1b fe ff ff       	call   801291 <printfmt>
            break;
  801476:	e9 8b 02 00 00       	jmp    801706 <vprintfmt+0x43b>

        // string
        case 's':
            if ((p = va_arg(ap, char *)) == NULL) {
  80147b:	8b 45 18             	mov    0x18(%ebp),%eax
  80147e:	8d 50 04             	lea    0x4(%eax),%edx
  801481:	89 55 18             	mov    %edx,0x18(%ebp)
  801484:	8b 30                	mov    (%eax),%esi
  801486:	85 f6                	test   %esi,%esi
  801488:	75 05                	jne    80148f <vprintfmt+0x1c4>
                p = "(null)";
  80148a:	be a1 1d 80 00       	mov    $0x801da1,%esi
            }
            if (width > 0 && padc != '-') {
  80148f:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
  801493:	0f 8e 8f 00 00 00    	jle    801528 <vprintfmt+0x25d>
  801499:	80 7d db 2d          	cmpb   $0x2d,-0x25(%ebp)
  80149d:	0f 84 85 00 00 00    	je     801528 <vprintfmt+0x25d>
                for (width -= strnlen(p, precision); width > 0; width --) {
  8014a3:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  8014a6:	89 44 24 04          	mov    %eax,0x4(%esp)
  8014aa:	89 34 24             	mov    %esi,(%esp)
  8014ad:	e8 4f f7 ff ff       	call   800c01 <strnlen>
  8014b2:	8b 55 e8             	mov    -0x18(%ebp),%edx
  8014b5:	29 c2                	sub    %eax,%edx
  8014b7:	89 d0                	mov    %edx,%eax
  8014b9:	89 45 e8             	mov    %eax,-0x18(%ebp)
  8014bc:	eb 1d                	jmp    8014db <vprintfmt+0x210>
                    putch(padc, putdat, fd);
  8014be:	0f be 45 db          	movsbl -0x25(%ebp),%eax
  8014c2:	8b 55 0c             	mov    0xc(%ebp),%edx
  8014c5:	89 54 24 08          	mov    %edx,0x8(%esp)
  8014c9:	8b 55 10             	mov    0x10(%ebp),%edx
  8014cc:	89 54 24 04          	mov    %edx,0x4(%esp)
  8014d0:	89 04 24             	mov    %eax,(%esp)
  8014d3:	8b 45 08             	mov    0x8(%ebp),%eax
  8014d6:	ff d0                	call   *%eax
                for (width -= strnlen(p, precision); width > 0; width --) {
  8014d8:	ff 4d e8             	decl   -0x18(%ebp)
  8014db:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
  8014df:	7f dd                	jg     8014be <vprintfmt+0x1f3>
                }
            }
            for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
  8014e1:	eb 45                	jmp    801528 <vprintfmt+0x25d>
                if (altflag && (ch < ' ' || ch > '~')) {
  8014e3:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
  8014e7:	74 26                	je     80150f <vprintfmt+0x244>
  8014e9:	83 fb 1f             	cmp    $0x1f,%ebx
  8014ec:	7e 05                	jle    8014f3 <vprintfmt+0x228>
  8014ee:	83 fb 7e             	cmp    $0x7e,%ebx
  8014f1:	7e 1c                	jle    80150f <vprintfmt+0x244>
                    putch('?', putdat, fd);
  8014f3:	8b 45 0c             	mov    0xc(%ebp),%eax
  8014f6:	89 44 24 08          	mov    %eax,0x8(%esp)
  8014fa:	8b 45 10             	mov    0x10(%ebp),%eax
  8014fd:	89 44 24 04          	mov    %eax,0x4(%esp)
  801501:	c7 04 24 3f 00 00 00 	movl   $0x3f,(%esp)
  801508:	8b 45 08             	mov    0x8(%ebp),%eax
  80150b:	ff d0                	call   *%eax
  80150d:	eb 16                	jmp    801525 <vprintfmt+0x25a>
                }
                else {
                    putch(ch, putdat, fd);
  80150f:	8b 45 0c             	mov    0xc(%ebp),%eax
  801512:	89 44 24 08          	mov    %eax,0x8(%esp)
  801516:	8b 45 10             	mov    0x10(%ebp),%eax
  801519:	89 44 24 04          	mov    %eax,0x4(%esp)
  80151d:	89 1c 24             	mov    %ebx,(%esp)
  801520:	8b 45 08             	mov    0x8(%ebp),%eax
  801523:	ff d0                	call   *%eax
            for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
  801525:	ff 4d e8             	decl   -0x18(%ebp)
  801528:	89 f0                	mov    %esi,%eax
  80152a:	8d 70 01             	lea    0x1(%eax),%esi
  80152d:	0f b6 00             	movzbl (%eax),%eax
  801530:	0f be d8             	movsbl %al,%ebx
  801533:	85 db                	test   %ebx,%ebx
  801535:	74 2e                	je     801565 <vprintfmt+0x29a>
  801537:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
  80153b:	78 a6                	js     8014e3 <vprintfmt+0x218>
  80153d:	ff 4d e4             	decl   -0x1c(%ebp)
  801540:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
  801544:	79 9d                	jns    8014e3 <vprintfmt+0x218>
                }
            }
            for (; width > 0; width --) {
  801546:	eb 1d                	jmp    801565 <vprintfmt+0x29a>
                putch(' ', putdat, fd);
  801548:	8b 45 0c             	mov    0xc(%ebp),%eax
  80154b:	89 44 24 08          	mov    %eax,0x8(%esp)
  80154f:	8b 45 10             	mov    0x10(%ebp),%eax
  801552:	89 44 24 04          	mov    %eax,0x4(%esp)
  801556:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
  80155d:	8b 45 08             	mov    0x8(%ebp),%eax
  801560:	ff d0                	call   *%eax
            for (; width > 0; width --) {
  801562:	ff 4d e8             	decl   -0x18(%ebp)
  801565:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
  801569:	7f dd                	jg     801548 <vprintfmt+0x27d>
            }
            break;
  80156b:	e9 96 01 00 00       	jmp    801706 <vprintfmt+0x43b>

        // (signed) decimal
        case 'd':
            num = getint(&ap, lflag);
  801570:	8b 45 e0             	mov    -0x20(%ebp),%eax
  801573:	89 44 24 04          	mov    %eax,0x4(%esp)
  801577:	8d 45 18             	lea    0x18(%ebp),%eax
  80157a:	89 04 24             	mov    %eax,(%esp)
  80157d:	e8 c4 fc ff ff       	call   801246 <getint>
  801582:	89 45 f0             	mov    %eax,-0x10(%ebp)
  801585:	89 55 f4             	mov    %edx,-0xc(%ebp)
            if ((long long)num < 0) {
  801588:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80158b:	8b 55 f4             	mov    -0xc(%ebp),%edx
  80158e:	85 d2                	test   %edx,%edx
  801590:	79 2d                	jns    8015bf <vprintfmt+0x2f4>
                putch('-', putdat, fd);
  801592:	8b 45 0c             	mov    0xc(%ebp),%eax
  801595:	89 44 24 08          	mov    %eax,0x8(%esp)
  801599:	8b 45 10             	mov    0x10(%ebp),%eax
  80159c:	89 44 24 04          	mov    %eax,0x4(%esp)
  8015a0:	c7 04 24 2d 00 00 00 	movl   $0x2d,(%esp)
  8015a7:	8b 45 08             	mov    0x8(%ebp),%eax
  8015aa:	ff d0                	call   *%eax
                num = -(long long)num;
  8015ac:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8015af:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8015b2:	f7 d8                	neg    %eax
  8015b4:	83 d2 00             	adc    $0x0,%edx
  8015b7:	f7 da                	neg    %edx
  8015b9:	89 45 f0             	mov    %eax,-0x10(%ebp)
  8015bc:	89 55 f4             	mov    %edx,-0xc(%ebp)
            }
            base = 10;
  8015bf:	c7 45 ec 0a 00 00 00 	movl   $0xa,-0x14(%ebp)
            goto number;
  8015c6:	e9 b6 00 00 00       	jmp    801681 <vprintfmt+0x3b6>

        // unsigned decimal
        case 'u':
            num = getuint(&ap, lflag);
  8015cb:	8b 45 e0             	mov    -0x20(%ebp),%eax
  8015ce:	89 44 24 04          	mov    %eax,0x4(%esp)
  8015d2:	8d 45 18             	lea    0x18(%ebp),%eax
  8015d5:	89 04 24             	mov    %eax,(%esp)
  8015d8:	e8 16 fc ff ff       	call   8011f3 <getuint>
  8015dd:	89 45 f0             	mov    %eax,-0x10(%ebp)
  8015e0:	89 55 f4             	mov    %edx,-0xc(%ebp)
            base = 10;
  8015e3:	c7 45 ec 0a 00 00 00 	movl   $0xa,-0x14(%ebp)
            goto number;
  8015ea:	e9 92 00 00 00       	jmp    801681 <vprintfmt+0x3b6>

        // (unsigned) octal
        case 'o':
            num = getuint(&ap, lflag);
  8015ef:	8b 45 e0             	mov    -0x20(%ebp),%eax
  8015f2:	89 44 24 04          	mov    %eax,0x4(%esp)
  8015f6:	8d 45 18             	lea    0x18(%ebp),%eax
  8015f9:	89 04 24             	mov    %eax,(%esp)
  8015fc:	e8 f2 fb ff ff       	call   8011f3 <getuint>
  801601:	89 45 f0             	mov    %eax,-0x10(%ebp)
  801604:	89 55 f4             	mov    %edx,-0xc(%ebp)
            base = 8;
  801607:	c7 45 ec 08 00 00 00 	movl   $0x8,-0x14(%ebp)
            goto number;
  80160e:	eb 71                	jmp    801681 <vprintfmt+0x3b6>

        // pointer
        case 'p':
            putch('0', putdat, fd);
  801610:	8b 45 0c             	mov    0xc(%ebp),%eax
  801613:	89 44 24 08          	mov    %eax,0x8(%esp)
  801617:	8b 45 10             	mov    0x10(%ebp),%eax
  80161a:	89 44 24 04          	mov    %eax,0x4(%esp)
  80161e:	c7 04 24 30 00 00 00 	movl   $0x30,(%esp)
  801625:	8b 45 08             	mov    0x8(%ebp),%eax
  801628:	ff d0                	call   *%eax
            putch('x', putdat, fd);
  80162a:	8b 45 0c             	mov    0xc(%ebp),%eax
  80162d:	89 44 24 08          	mov    %eax,0x8(%esp)
  801631:	8b 45 10             	mov    0x10(%ebp),%eax
  801634:	89 44 24 04          	mov    %eax,0x4(%esp)
  801638:	c7 04 24 78 00 00 00 	movl   $0x78,(%esp)
  80163f:	8b 45 08             	mov    0x8(%ebp),%eax
  801642:	ff d0                	call   *%eax
            num = (unsigned long long)(uintptr_t)va_arg(ap, void *);
  801644:	8b 45 18             	mov    0x18(%ebp),%eax
  801647:	8d 50 04             	lea    0x4(%eax),%edx
  80164a:	89 55 18             	mov    %edx,0x18(%ebp)
  80164d:	8b 00                	mov    (%eax),%eax
  80164f:	89 45 f0             	mov    %eax,-0x10(%ebp)
  801652:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
            base = 16;
  801659:	c7 45 ec 10 00 00 00 	movl   $0x10,-0x14(%ebp)
            goto number;
  801660:	eb 1f                	jmp    801681 <vprintfmt+0x3b6>

        // (unsigned) hexadecimal
        case 'x':
            num = getuint(&ap, lflag);
  801662:	8b 45 e0             	mov    -0x20(%ebp),%eax
  801665:	89 44 24 04          	mov    %eax,0x4(%esp)
  801669:	8d 45 18             	lea    0x18(%ebp),%eax
  80166c:	89 04 24             	mov    %eax,(%esp)
  80166f:	e8 7f fb ff ff       	call   8011f3 <getuint>
  801674:	89 45 f0             	mov    %eax,-0x10(%ebp)
  801677:	89 55 f4             	mov    %edx,-0xc(%ebp)
            base = 16;
  80167a:	c7 45 ec 10 00 00 00 	movl   $0x10,-0x14(%ebp)
        number:
            printnum(putch, fd, putdat, num, base, width, padc);
  801681:	0f be 55 db          	movsbl -0x25(%ebp),%edx
  801685:	8b 45 ec             	mov    -0x14(%ebp),%eax
  801688:	89 54 24 1c          	mov    %edx,0x1c(%esp)
  80168c:	8b 55 e8             	mov    -0x18(%ebp),%edx
  80168f:	89 54 24 18          	mov    %edx,0x18(%esp)
  801693:	89 44 24 14          	mov    %eax,0x14(%esp)
  801697:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80169a:	8b 55 f4             	mov    -0xc(%ebp),%edx
  80169d:	89 44 24 0c          	mov    %eax,0xc(%esp)
  8016a1:	89 54 24 10          	mov    %edx,0x10(%esp)
  8016a5:	8b 45 10             	mov    0x10(%ebp),%eax
  8016a8:	89 44 24 08          	mov    %eax,0x8(%esp)
  8016ac:	8b 45 0c             	mov    0xc(%ebp),%eax
  8016af:	89 44 24 04          	mov    %eax,0x4(%esp)
  8016b3:	8b 45 08             	mov    0x8(%ebp),%eax
  8016b6:	89 04 24             	mov    %eax,(%esp)
  8016b9:	e8 1c fa ff ff       	call   8010da <printnum>
            break;
  8016be:	eb 46                	jmp    801706 <vprintfmt+0x43b>

        // escaped '%' character
        case '%':
            putch(ch, putdat, fd);
  8016c0:	8b 45 0c             	mov    0xc(%ebp),%eax
  8016c3:	89 44 24 08          	mov    %eax,0x8(%esp)
  8016c7:	8b 45 10             	mov    0x10(%ebp),%eax
  8016ca:	89 44 24 04          	mov    %eax,0x4(%esp)
  8016ce:	89 1c 24             	mov    %ebx,(%esp)
  8016d1:	8b 45 08             	mov    0x8(%ebp),%eax
  8016d4:	ff d0                	call   *%eax
            break;
  8016d6:	eb 2e                	jmp    801706 <vprintfmt+0x43b>

        // unrecognized escape sequence - just print it literally
        default:
            putch('%', putdat, fd);
  8016d8:	8b 45 0c             	mov    0xc(%ebp),%eax
  8016db:	89 44 24 08          	mov    %eax,0x8(%esp)
  8016df:	8b 45 10             	mov    0x10(%ebp),%eax
  8016e2:	89 44 24 04          	mov    %eax,0x4(%esp)
  8016e6:	c7 04 24 25 00 00 00 	movl   $0x25,(%esp)
  8016ed:	8b 45 08             	mov    0x8(%ebp),%eax
  8016f0:	ff d0                	call   *%eax
            for (fmt --; fmt[-1] != '%'; fmt --)
  8016f2:	ff 4d 14             	decl   0x14(%ebp)
  8016f5:	eb 03                	jmp    8016fa <vprintfmt+0x42f>
  8016f7:	ff 4d 14             	decl   0x14(%ebp)
  8016fa:	8b 45 14             	mov    0x14(%ebp),%eax
  8016fd:	48                   	dec    %eax
  8016fe:	0f b6 00             	movzbl (%eax),%eax
  801701:	3c 25                	cmp    $0x25,%al
  801703:	75 f2                	jne    8016f7 <vprintfmt+0x42c>
                /* do nothing */;
            break;
  801705:	90                   	nop
    while (1) {
  801706:	e9 cc fb ff ff       	jmp    8012d7 <vprintfmt+0xc>
                return;
  80170b:	90                   	nop
        }
    }
}
  80170c:	83 c4 40             	add    $0x40,%esp
  80170f:	5b                   	pop    %ebx
  801710:	5e                   	pop    %esi
  801711:	5d                   	pop    %ebp
  801712:	c3                   	ret    

00801713 <sprintputch>:
 * sprintputch - 'print' a single character in a buffer
 * @ch:         the character will be printed
 * @b:          the buffer to place the character @ch
 * */
static void
sprintputch(int ch, struct sprintbuf *b) {
  801713:	f3 0f 1e fb          	endbr32 
  801717:	55                   	push   %ebp
  801718:	89 e5                	mov    %esp,%ebp
    b->cnt ++;
  80171a:	8b 45 0c             	mov    0xc(%ebp),%eax
  80171d:	8b 40 08             	mov    0x8(%eax),%eax
  801720:	8d 50 01             	lea    0x1(%eax),%edx
  801723:	8b 45 0c             	mov    0xc(%ebp),%eax
  801726:	89 50 08             	mov    %edx,0x8(%eax)
    if (b->buf < b->ebuf) {
  801729:	8b 45 0c             	mov    0xc(%ebp),%eax
  80172c:	8b 10                	mov    (%eax),%edx
  80172e:	8b 45 0c             	mov    0xc(%ebp),%eax
  801731:	8b 40 04             	mov    0x4(%eax),%eax
  801734:	39 c2                	cmp    %eax,%edx
  801736:	73 12                	jae    80174a <sprintputch+0x37>
        *b->buf ++ = ch;
  801738:	8b 45 0c             	mov    0xc(%ebp),%eax
  80173b:	8b 00                	mov    (%eax),%eax
  80173d:	8d 48 01             	lea    0x1(%eax),%ecx
  801740:	8b 55 0c             	mov    0xc(%ebp),%edx
  801743:	89 0a                	mov    %ecx,(%edx)
  801745:	8b 55 08             	mov    0x8(%ebp),%edx
  801748:	88 10                	mov    %dl,(%eax)
    }
}
  80174a:	90                   	nop
  80174b:	5d                   	pop    %ebp
  80174c:	c3                   	ret    

0080174d <snprintf>:
 * @str:        the buffer to place the result into
 * @size:       the size of buffer, including the trailing null space
 * @fmt:        the format string to use
 * */
int
snprintf(char *str, size_t size, const char *fmt, ...) {
  80174d:	f3 0f 1e fb          	endbr32 
  801751:	55                   	push   %ebp
  801752:	89 e5                	mov    %esp,%ebp
  801754:	83 ec 28             	sub    $0x28,%esp
    va_list ap;
    int cnt;
    va_start(ap, fmt);
  801757:	8d 45 14             	lea    0x14(%ebp),%eax
  80175a:	89 45 f0             	mov    %eax,-0x10(%ebp)
    cnt = vsnprintf(str, size, fmt, ap);
  80175d:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801760:	89 44 24 0c          	mov    %eax,0xc(%esp)
  801764:	8b 45 10             	mov    0x10(%ebp),%eax
  801767:	89 44 24 08          	mov    %eax,0x8(%esp)
  80176b:	8b 45 0c             	mov    0xc(%ebp),%eax
  80176e:	89 44 24 04          	mov    %eax,0x4(%esp)
  801772:	8b 45 08             	mov    0x8(%ebp),%eax
  801775:	89 04 24             	mov    %eax,(%esp)
  801778:	e8 08 00 00 00       	call   801785 <vsnprintf>
  80177d:	89 45 f4             	mov    %eax,-0xc(%ebp)
    va_end(ap);
    return cnt;
  801780:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
  801783:	c9                   	leave  
  801784:	c3                   	ret    

00801785 <vsnprintf>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want snprintf() instead.
 * */
int
vsnprintf(char *str, size_t size, const char *fmt, va_list ap) {
  801785:	f3 0f 1e fb          	endbr32 
  801789:	55                   	push   %ebp
  80178a:	89 e5                	mov    %esp,%ebp
  80178c:	83 ec 38             	sub    $0x38,%esp
    struct sprintbuf b = {str, str + size - 1, 0};
  80178f:	8b 45 08             	mov    0x8(%ebp),%eax
  801792:	89 45 ec             	mov    %eax,-0x14(%ebp)
  801795:	8b 45 0c             	mov    0xc(%ebp),%eax
  801798:	8d 50 ff             	lea    -0x1(%eax),%edx
  80179b:	8b 45 08             	mov    0x8(%ebp),%eax
  80179e:	01 d0                	add    %edx,%eax
  8017a0:	89 45 f0             	mov    %eax,-0x10(%ebp)
  8017a3:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    if (str == NULL || b.buf > b.ebuf) {
  8017aa:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
  8017ae:	74 0a                	je     8017ba <vsnprintf+0x35>
  8017b0:	8b 55 ec             	mov    -0x14(%ebp),%edx
  8017b3:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8017b6:	39 c2                	cmp    %eax,%edx
  8017b8:	76 07                	jbe    8017c1 <vsnprintf+0x3c>
        return -E_INVAL;
  8017ba:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8017bf:	eb 32                	jmp    8017f3 <vsnprintf+0x6e>
    }
    // print the string to the buffer
    vprintfmt((void*)sprintputch, NO_FD, &b, fmt, ap);
  8017c1:	8b 45 14             	mov    0x14(%ebp),%eax
  8017c4:	89 44 24 10          	mov    %eax,0x10(%esp)
  8017c8:	8b 45 10             	mov    0x10(%ebp),%eax
  8017cb:	89 44 24 0c          	mov    %eax,0xc(%esp)
  8017cf:	8d 45 ec             	lea    -0x14(%ebp),%eax
  8017d2:	89 44 24 08          	mov    %eax,0x8(%esp)
  8017d6:	c7 44 24 04 d9 6a ff 	movl   $0xffff6ad9,0x4(%esp)
  8017dd:	ff 
  8017de:	c7 04 24 13 17 80 00 	movl   $0x801713,(%esp)
  8017e5:	e8 e1 fa ff ff       	call   8012cb <vprintfmt>
    // null terminate the buffer
    *b.buf = '\0';
  8017ea:	8b 45 ec             	mov    -0x14(%ebp),%eax
  8017ed:	c6 00 00             	movb   $0x0,(%eax)
    return b.cnt;
  8017f0:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
  8017f3:	c9                   	leave  
  8017f4:	c3                   	ret    

008017f5 <hash32>:
 * @bits:   the number of bits in a return value
 *
 * High bits are more random, so we use them.
 * */
uint32_t
hash32(uint32_t val, unsigned int bits) {
  8017f5:	f3 0f 1e fb          	endbr32 
  8017f9:	55                   	push   %ebp
  8017fa:	89 e5                	mov    %esp,%ebp
  8017fc:	83 ec 10             	sub    $0x10,%esp
    uint32_t hash = val * GOLDEN_RATIO_PRIME_32;
  8017ff:	8b 45 08             	mov    0x8(%ebp),%eax
  801802:	69 c0 01 00 37 9e    	imul   $0x9e370001,%eax,%eax
  801808:	89 45 fc             	mov    %eax,-0x4(%ebp)
    return (hash >> (32 - bits));
  80180b:	b8 20 00 00 00       	mov    $0x20,%eax
  801810:	2b 45 0c             	sub    0xc(%ebp),%eax
  801813:	8b 55 fc             	mov    -0x4(%ebp),%edx
  801816:	88 c1                	mov    %al,%cl
  801818:	d3 ea                	shr    %cl,%edx
  80181a:	89 d0                	mov    %edx,%eax
}
  80181c:	c9                   	leave  
  80181d:	c3                   	ret    

0080181e <rand>:
 * rand - returns a pseudo-random integer
 *
 * The rand() function return a value in the range [0, RAND_MAX].
 * */
int
rand(void) {
  80181e:	f3 0f 1e fb          	endbr32 
  801822:	55                   	push   %ebp
  801823:	89 e5                	mov    %esp,%ebp
  801825:	57                   	push   %edi
  801826:	56                   	push   %esi
  801827:	53                   	push   %ebx
  801828:	83 ec 24             	sub    $0x24,%esp
    next = (next * 0x5DEECE66DLL + 0xBLL) & ((1LL << 48) - 1);
  80182b:	a1 08 30 80 00       	mov    0x803008,%eax
  801830:	8b 15 0c 30 80 00    	mov    0x80300c,%edx
  801836:	69 fa 6d e6 ec de    	imul   $0xdeece66d,%edx,%edi
  80183c:	6b f0 05             	imul   $0x5,%eax,%esi
  80183f:	01 fe                	add    %edi,%esi
  801841:	bf 6d e6 ec de       	mov    $0xdeece66d,%edi
  801846:	f7 e7                	mul    %edi
  801848:	01 d6                	add    %edx,%esi
  80184a:	89 f2                	mov    %esi,%edx
  80184c:	83 c0 0b             	add    $0xb,%eax
  80184f:	83 d2 00             	adc    $0x0,%edx
  801852:	89 c7                	mov    %eax,%edi
  801854:	83 e7 ff             	and    $0xffffffff,%edi
  801857:	89 f9                	mov    %edi,%ecx
  801859:	0f b7 da             	movzwl %dx,%ebx
  80185c:	89 0d 08 30 80 00    	mov    %ecx,0x803008
  801862:	89 1d 0c 30 80 00    	mov    %ebx,0x80300c
    unsigned long long result = (next >> 12);
  801868:	a1 08 30 80 00       	mov    0x803008,%eax
  80186d:	8b 15 0c 30 80 00    	mov    0x80300c,%edx
  801873:	0f ac d0 0c          	shrd   $0xc,%edx,%eax
  801877:	c1 ea 0c             	shr    $0xc,%edx
  80187a:	89 45 e0             	mov    %eax,-0x20(%ebp)
  80187d:	89 55 e4             	mov    %edx,-0x1c(%ebp)
    return (int)do_div(result, RAND_MAX + 1);
  801880:	c7 45 dc 00 00 00 80 	movl   $0x80000000,-0x24(%ebp)
  801887:	8b 45 e0             	mov    -0x20(%ebp),%eax
  80188a:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  80188d:	89 45 d8             	mov    %eax,-0x28(%ebp)
  801890:	89 55 e8             	mov    %edx,-0x18(%ebp)
  801893:	8b 45 e8             	mov    -0x18(%ebp),%eax
  801896:	89 45 ec             	mov    %eax,-0x14(%ebp)
  801899:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
  80189d:	74 1c                	je     8018bb <rand+0x9d>
  80189f:	8b 45 e8             	mov    -0x18(%ebp),%eax
  8018a2:	ba 00 00 00 00       	mov    $0x0,%edx
  8018a7:	f7 75 dc             	divl   -0x24(%ebp)
  8018aa:	89 55 ec             	mov    %edx,-0x14(%ebp)
  8018ad:	8b 45 e8             	mov    -0x18(%ebp),%eax
  8018b0:	ba 00 00 00 00       	mov    $0x0,%edx
  8018b5:	f7 75 dc             	divl   -0x24(%ebp)
  8018b8:	89 45 e8             	mov    %eax,-0x18(%ebp)
  8018bb:	8b 45 d8             	mov    -0x28(%ebp),%eax
  8018be:	8b 55 ec             	mov    -0x14(%ebp),%edx
  8018c1:	f7 75 dc             	divl   -0x24(%ebp)
  8018c4:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8018c7:	89 55 d4             	mov    %edx,-0x2c(%ebp)
  8018ca:	8b 45 d8             	mov    -0x28(%ebp),%eax
  8018cd:	8b 55 e8             	mov    -0x18(%ebp),%edx
  8018d0:	89 45 e0             	mov    %eax,-0x20(%ebp)
  8018d3:	89 55 e4             	mov    %edx,-0x1c(%ebp)
  8018d6:	8b 45 d4             	mov    -0x2c(%ebp),%eax
}
  8018d9:	83 c4 24             	add    $0x24,%esp
  8018dc:	5b                   	pop    %ebx
  8018dd:	5e                   	pop    %esi
  8018de:	5f                   	pop    %edi
  8018df:	5d                   	pop    %ebp
  8018e0:	c3                   	ret    

008018e1 <srand>:
/* *
 * srand - seed the random number generator with the given number
 * @seed:   the required seed number
 * */
void
srand(unsigned int seed) {
  8018e1:	f3 0f 1e fb          	endbr32 
  8018e5:	55                   	push   %ebp
  8018e6:	89 e5                	mov    %esp,%ebp
    next = seed;
  8018e8:	8b 45 08             	mov    0x8(%ebp),%eax
  8018eb:	ba 00 00 00 00       	mov    $0x0,%edx
  8018f0:	a3 08 30 80 00       	mov    %eax,0x803008
  8018f5:	89 15 0c 30 80 00    	mov    %edx,0x80300c
}
  8018fb:	90                   	nop
  8018fc:	5d                   	pop    %ebp
  8018fd:	c3                   	ret    

008018fe <main>:
#include <ulib.h>

int magic = -0x10384;

int
main(void) {
  8018fe:	f3 0f 1e fb          	endbr32 
  801902:	55                   	push   %ebp
  801903:	89 e5                	mov    %esp,%ebp
  801905:	83 e4 f0             	and    $0xfffffff0,%esp
  801908:	83 ec 20             	sub    $0x20,%esp
    int pid, code;
    cprintf("I am the parent. Forking the child...\n");
  80190b:	c7 04 24 00 1f 80 00 	movl   $0x801f00,(%esp)
  801912:	e8 41 ee ff ff       	call   800758 <cprintf>
    if ((pid = fork()) == 0) {
  801917:	e8 99 f1 ff ff       	call   800ab5 <fork>
  80191c:	89 44 24 1c          	mov    %eax,0x1c(%esp)
  801920:	83 7c 24 1c 00       	cmpl   $0x0,0x1c(%esp)
  801925:	75 3c                	jne    801963 <main+0x65>
        cprintf("I am the child.\n");
  801927:	c7 04 24 27 1f 80 00 	movl   $0x801f27,(%esp)
  80192e:	e8 25 ee ff ff       	call   800758 <cprintf>
        yield();
  801933:	e8 cc f1 ff ff       	call   800b04 <yield>
        yield();
  801938:	e8 c7 f1 ff ff       	call   800b04 <yield>
        yield();
  80193d:	e8 c2 f1 ff ff       	call   800b04 <yield>
        yield();
  801942:	e8 bd f1 ff ff       	call   800b04 <yield>
        yield();
  801947:	e8 b8 f1 ff ff       	call   800b04 <yield>
        yield();
  80194c:	e8 b3 f1 ff ff       	call   800b04 <yield>
        yield();
  801951:	e8 ae f1 ff ff       	call   800b04 <yield>
        exit(magic);
  801956:	a1 10 30 80 00       	mov    0x803010,%eax
  80195b:	89 04 24             	mov    %eax,(%esp)
  80195e:	e8 2f f1 ff ff       	call   800a92 <exit>
    }
    else {
        cprintf("I am parent, fork a child pid %d\n",pid);
  801963:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  801967:	89 44 24 04          	mov    %eax,0x4(%esp)
  80196b:	c7 04 24 38 1f 80 00 	movl   $0x801f38,(%esp)
  801972:	e8 e1 ed ff ff       	call   800758 <cprintf>
    }
    assert(pid > 0);
  801977:	83 7c 24 1c 00       	cmpl   $0x0,0x1c(%esp)
  80197c:	7f 24                	jg     8019a2 <main+0xa4>
  80197e:	c7 44 24 0c 5a 1f 80 	movl   $0x801f5a,0xc(%esp)
  801985:	00 
  801986:	c7 44 24 08 62 1f 80 	movl   $0x801f62,0x8(%esp)
  80198d:	00 
  80198e:	c7 44 24 04 18 00 00 	movl   $0x18,0x4(%esp)
  801995:	00 
  801996:	c7 04 24 77 1f 80 00 	movl   $0x801f77,(%esp)
  80199d:	e8 7e e6 ff ff       	call   800020 <__panic>
    cprintf("I am the parent, waiting now..\n");
  8019a2:	c7 04 24 84 1f 80 00 	movl   $0x801f84,(%esp)
  8019a9:	e8 aa ed ff ff       	call   800758 <cprintf>

    assert(waitpid(pid, &code) == 0 && code == magic);
  8019ae:	8d 44 24 18          	lea    0x18(%esp),%eax
  8019b2:	89 44 24 04          	mov    %eax,0x4(%esp)
  8019b6:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  8019ba:	89 04 24             	mov    %eax,(%esp)
  8019bd:	e8 24 f1 ff ff       	call   800ae6 <waitpid>
  8019c2:	85 c0                	test   %eax,%eax
  8019c4:	75 0d                	jne    8019d3 <main+0xd5>
  8019c6:	8b 54 24 18          	mov    0x18(%esp),%edx
  8019ca:	a1 10 30 80 00       	mov    0x803010,%eax
  8019cf:	39 c2                	cmp    %eax,%edx
  8019d1:	74 24                	je     8019f7 <main+0xf9>
  8019d3:	c7 44 24 0c a4 1f 80 	movl   $0x801fa4,0xc(%esp)
  8019da:	00 
  8019db:	c7 44 24 08 62 1f 80 	movl   $0x801f62,0x8(%esp)
  8019e2:	00 
  8019e3:	c7 44 24 04 1b 00 00 	movl   $0x1b,0x4(%esp)
  8019ea:	00 
  8019eb:	c7 04 24 77 1f 80 00 	movl   $0x801f77,(%esp)
  8019f2:	e8 29 e6 ff ff       	call   800020 <__panic>
    assert(waitpid(pid, &code) != 0 && wait() != 0);
  8019f7:	8d 44 24 18          	lea    0x18(%esp),%eax
  8019fb:	89 44 24 04          	mov    %eax,0x4(%esp)
  8019ff:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  801a03:	89 04 24             	mov    %eax,(%esp)
  801a06:	e8 db f0 ff ff       	call   800ae6 <waitpid>
  801a0b:	85 c0                	test   %eax,%eax
  801a0d:	74 09                	je     801a18 <main+0x11a>
  801a0f:	e8 b2 f0 ff ff       	call   800ac6 <wait>
  801a14:	85 c0                	test   %eax,%eax
  801a16:	75 24                	jne    801a3c <main+0x13e>
  801a18:	c7 44 24 0c d0 1f 80 	movl   $0x801fd0,0xc(%esp)
  801a1f:	00 
  801a20:	c7 44 24 08 62 1f 80 	movl   $0x801f62,0x8(%esp)
  801a27:	00 
  801a28:	c7 44 24 04 1c 00 00 	movl   $0x1c,0x4(%esp)
  801a2f:	00 
  801a30:	c7 04 24 77 1f 80 00 	movl   $0x801f77,(%esp)
  801a37:	e8 e4 e5 ff ff       	call   800020 <__panic>
    cprintf("waitpid %d ok.\n", pid);
  801a3c:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  801a40:	89 44 24 04          	mov    %eax,0x4(%esp)
  801a44:	c7 04 24 f8 1f 80 00 	movl   $0x801ff8,(%esp)
  801a4b:	e8 08 ed ff ff       	call   800758 <cprintf>

    cprintf("exit pass.\n");
  801a50:	c7 04 24 08 20 80 00 	movl   $0x802008,(%esp)
  801a57:	e8 fc ec ff ff       	call   800758 <cprintf>
    return 0;
  801a5c:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801a61:	c9                   	leave  
  801a62:	c3                   	ret    
